OutputGen 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/env bash
  2. # shellcheck shell=bash
  3. # ``````````````````````````````````````````````````````````````````````````````
  4. # Function name: OutputGen()
  5. #
  6. # Description:
  7. # Show info about process on the screen.
  8. #
  9. # Usage:
  10. # OutputGen
  11. #
  12. # Examples:
  13. # OutputGen
  14. #
  15. function OutputGen() {
  16. # shellcheck disable=SC2034
  17. local _FUNCTION_ID="OutputGen"
  18. local _STATE=0
  19. # Check that _tor_proc_socks and _tor_proc_control are available.
  20. # shellcheck disable=SC2154
  21. CheckConn "$_tor_proc_socks" ; local _tport_state_socks="$?"
  22. # shellcheck disable=SC2154
  23. CheckConn "$_tor_proc_control" ; local _tport_state_control="$?"
  24. if [[ $_tport_state_socks -ne 0 ]] ; then
  25. export _tport_status_socks="false"
  26. elif [[ $_tport_state_control -ne 0 ]] ; then
  27. export _tport_status_control="false"
  28. else
  29. export _tport_status_socks="true"
  30. export _tport_status_control="true"
  31. fi
  32. # shellcheck disable=SC2154
  33. printf " \\e[1;30mprocess_id\\e[m: \\e[1;39m%s\\e[m\\n" "$_tor_proc_id"
  34. # shellcheck disable=SC2154
  35. printf " \\e[1;30mprocess_status\\e[m: \\e[1;32m%s\\e[m\\n" "$_tor_pid_status"
  36. printf " \\e[1;30msocks_port\\e[m: \\e[0;33m%d\\e[m\\n" "$_tor_proc_socks"
  37. # shellcheck disable=SC2154
  38. printf " \\e[1;30msocks_status\\e[m: \\e[0;32m%s\\e[m\\n" "$_tport_status_socks"
  39. printf " \\e[1;30mcontrol_port\\e[m: \\e[0;33m%d\\e[m\\n" "$_tor_proc_control"
  40. # shellcheck disable=SC2154
  41. printf " \\e[1;30mcontrol_status\\e[m: \\e[0;32m%s\\e[m\\n" "$_tport_status_control"
  42. # shellcheck disable=SC2154
  43. printf " \\e[1;30mdata_dir\\e[m: \\e[0;37m%s\\e[m\\n" "$_tor_prod_data_dir"
  44. return $_STATE
  45. }