blob: 34271a5b467b5902b8196aa6e92dbc2260759509 (
plain)
1 #!/bin/sh
2 #
3 # /etc/rc.d/tor: start/stop tor daemon
4 #
5
6 SSD=/sbin/start-stop-daemon
7 PROG=/usr/bin/tor
8 PID=/var/run/tor.pid
9 OPTS=
10
11 case $1 in
12 start)
13 $SSD --start --make-pidfile --pidfile $PID --chuid tor:tor \
14 --exec $PROG --background -- $OPTS
15 ;;
16 stop)
17 $SSD --stop --retry 10 --pidfile $PID --remove-pidfile
18 ;;
19 reload)
20 $SSD --stop --signal HUP --pidfile $PID
21 ;;
22 restart)
23 $0 stop
24 $0 start
25 ;;
26 check-config)
27 su tor -c "$PROG --verify-config"
28 ;;
29 status)
30 $SSD --status --pidfile $PID
31 case $? in
32 0) echo "$PROG is running with pid $(cat $PID)" ;;
33 1) echo "$PROG is not running but the pid file $PID exists" ;;
34 3) echo "$PROG is not running" ;;
35 4) echo "Unable to determine the program status" ;;
36 esac
37 ;;
38 *)
39 echo "usage: $0 [start|stop|reload|restart|check-config|status]"
40 ;;
41 esac
42
43 # End of file
|