tor.sh.in 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/sh
  2. #
  3. # tor The Onion Router
  4. #
  5. # Startup/shutdown script for tor. This is a wrapper around torctl;
  6. # torctl does the actual work in a relatively system-independent, or at least
  7. # distribution-independent, way, and this script deals with fitting the
  8. # whole thing into the conventions of the particular system at hand.
  9. # This particular script is written for Red Hat/Fedora Linux, and may
  10. # also work on Mandrake, but not SuSE.
  11. #
  12. # These next couple of lines "declare" tor for the "chkconfig" program,
  13. # originally from SGI, used on Red Hat/Fedora and probably elsewhere.
  14. #
  15. # chkconfig: 2345 90 10
  16. # description: Onion Router - A low-latency anonymous proxy
  17. #
  18. # Library functions
  19. if [ -f /etc/rc.d/init.d/functions ]; then
  20. . /etc/rc.d/init.d/functions
  21. elif [ -f /etc/init.d/functions ]; then
  22. . /etc/init.d/functions
  23. fi
  24. TORCTL=@BINDIR@/torctl
  25. # torctl will use these environment variables
  26. TORUSER=@TORUSER@
  27. export TORUSER
  28. TORGROUP=@TORGROUP@
  29. export TORGROUP
  30. if [ -x /bin/su ] ; then
  31. SUPROG=/bin/su
  32. elif [ -x /sbin/su ] ; then
  33. SUPROG=/sbin/su
  34. elif [ -x /usr/bin/su ] ; then
  35. SUPROG=/usr/bin/su
  36. elif [ -x /usr/sbin/su ] ; then
  37. SUPROG=/usr/sbin/su
  38. else
  39. SUPROG=/bin/su
  40. fi
  41. case "$1" in
  42. start)
  43. action $"Starting tor:" $TORCTL start
  44. RETVAL=$?
  45. ;;
  46. stop)
  47. action $"Stopping tor:" $TORCTL stop
  48. RETVAL=$?
  49. ;;
  50. restart)
  51. action $"Restarting tor:" $TORCTL restart
  52. RETVAL=$?
  53. ;;
  54. reload)
  55. action $"Reloading tor:" $TORCTL reload
  56. RETVAL=$?
  57. ;;
  58. status)
  59. $TORCTL status
  60. RETVAL=$?
  61. ;;
  62. *)
  63. echo "Usage: $0 (start|stop|restart|reload|status)"
  64. RETVAL=1
  65. esac
  66. exit $RETVAL