tor/rc.tor

changeset 791
a5b2210360f9
parent 789
cbbc8daa8174
equal deleted inserted replaced
0:257ea75facf9 1:754666d263be
16 tor_pidfile="@l_prefix@/var/tor/tor.pid" 16 tor_pidfile="@l_prefix@/var/tor/tor.pid"
17 tor_signal () { 17 tor_signal () {
18 [ -f $tor_pidfile ] && kill -$1 `cat $tor_pidfile` 18 [ -f $tor_pidfile ] && kill -$1 `cat $tor_pidfile`
19 } 19 }
20 20
21 %status -u @l_rusr@ -o 21 %status -u @l_susr@ -o
22 tor_usable="unknown" 22 tor_usable="unknown"
23 tor_active="no" 23 tor_active="no"
24 rcService tor enable yes && \ 24 rcService tor enable yes && \
25 tor_signal 0 && tor_active="yes" 25 tor_signal 0 && tor_active="yes"
26 echo "tor_enable=\"$tor_enable\"" 26 echo "tor_enable=\"$tor_enable\""
27 echo "tor_usable=\"$tor_usable\"" 27 echo "tor_usable=\"$tor_usable\""
28 echo "tor_active=\"$tor_active\"" 28 echo "tor_active=\"$tor_active\""
29 29
30 %start -u @l_rusr@ 30 %start -u @l_susr@
31 rcService tor enable yes || exit 0 31 rcService tor enable yes || exit 0
32 rcService tor active yes && exit 0 32 rcService tor active yes && exit 0
33 @l_prefix@/bin/tor 33 @l_prefix@/bin/tor
34 34
35 %stop -u @l_rusr@ 35 %stop -u @l_susr@
36 rcService tor enable yes || exit 0 36 rcService tor enable yes || exit 0
37 rcService tor active no && exit 0 37 rcService tor active no && exit 0
38 tor_signal TERM 38 tor_signal TERM
39 sleep 2 39 sleep 2
40 rm -f $tor_pidfile >/dev/null 2>&1 || true 40 rm -f $tor_pidfile >/dev/null 2>&1 || true
41 41
42 %restart -u @l_rusr@ 42 %restart -u @l_susr@
43 rcService tor enable yes || exit 0 43 rcService tor enable yes || exit 0
44 rcService tor active no && exit 0 44 rcService tor active no && exit 0
45 rc tor stop start 45 rc tor stop start
46 46
47 %reload -u @l_rusr@ 47 %reload -u @l_susr@
48 rcService tor enable yes || exit 0 48 rcService tor enable yes || exit 0
49 rcService tor active no && exit 0 49 rcService tor active no && exit 0
50 tor_signal HUP 50 tor_signal HUP
51 51
52 %daily -u @l_susr@ 52 %daily -u @l_susr@
53 rcService tor enable yes || exit 0 53 rcService tor enable yes || exit 0
54 shtool rotate -f \ 54 shtool rotate -f \
55 -n ${tor_log_numfiles} -s ${tor_log_minsize} -d \ 55 -n ${tor_log_numfiles} -s ${tor_log_minsize} -d \
56 -z ${tor_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \ 56 -z ${tor_log_complevel} -m 664 -o @l_susr@ -g @l_rgrp@ \
57 -P "${tor_log_prolog}" \ 57 -P "${tor_log_prolog}" \
58 -E "${tor_log_epilog}; rc tor restart" \ 58 -E "${tor_log_epilog}; rc tor restart" \
59 ${tor_logfile} 59 ${tor_logfile}
60 60

mercurial