Sat, 25 Jan 2014 18:21:16 +0100
Improve runtime configuration including additional network definition.
1 #!@l_prefix@/bin/openpkg rc
2 ##
3 ## rc.tor -- Run-Commands
4 ##
6 %config
7 tor_enable="$openpkg_rc_def"
8 tor_log_prolog="true"
9 tor_log_epilog="true"
10 tor_log_numfiles="10"
11 tor_log_minsize="1M"
12 tor_log_complevel="9"
14 %common
15 tor_logfile="@l_prefix@/var/tor/tor.log"
16 tor_pidfile="@l_prefix@/var/tor/tor.pid"
17 tor_signal () {
18 [ -f $tor_pidfile ] && kill -$1 `cat $tor_pidfile`
19 }
21 %status -u @l_susr@ -o
22 tor_usable="unknown"
23 tor_active="no"
24 rcService tor enable yes && \
25 tor_signal 0 && tor_active="yes"
26 echo "tor_enable=\"$tor_enable\""
27 echo "tor_usable=\"$tor_usable\""
28 echo "tor_active=\"$tor_active\""
30 %start -u @l_susr@
31 rcService tor enable yes || exit 0
32 rcService tor active yes && exit 0
33 @l_prefix@/bin/tor
35 %stop -u @l_susr@
36 rcService tor enable yes || exit 0
37 rcService tor active no && exit 0
38 tor_signal TERM
39 sleep 2
40 rm -f $tor_pidfile >/dev/null 2>&1 || true
42 %restart -u @l_susr@
43 rcService tor enable yes || exit 0
44 rcService tor active no && exit 0
45 rc tor stop start
47 %reload -u @l_susr@
48 rcService tor enable yes || exit 0
49 rcService tor active no && exit 0
50 tor_signal HUP
52 %daily -u @l_susr@
53 rcService tor enable yes || exit 0
54 shtool rotate -f \
55 -n ${tor_log_numfiles} -s ${tor_log_minsize} -d \
56 -z ${tor_log_complevel} -m 664 -o @l_susr@ -g @l_rgrp@ \
57 -P "${tor_log_prolog}" \
58 -E "${tor_log_epilog}; rc tor restart" \
59 ${tor_logfile}