blob: 9b6db2206c8aa62648eea22aa89fff8472a7ed2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: tor.in,v 1.2 2005/09/27 17:44:12 tv Exp $
#
# PROVIDE: tor
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# You will need to set some variables in /etc/rc.conf to start tor:
#
# tor=YES
if [ -f /etc/rc.subr ]
then
. /etc/rc.subr
fi
name="tor"
rcvar=$name
command="@PREFIX@/bin/tor"
required_files="@PKG_SYSCONFDIR@/torrc"
start_cmd="tor_start"
stop_cmd="tor_stop"
pidfile="@PKG_HOME@/${name}.pid"
restart_cmd="tor_stop ; tor_start"
tor_start ()
{
${command} --User @TOR_USER@ --Group @TOR_GROUP@ --RunAsDaemon 1 \
--DataDirectory @PKG_HOME@ --PIDFile ${pidfile}
}
tor_stop()
{
kill `cat ${pidfile}` 2>/dev/null
}
if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]
then
load_rc_config $name
run_rc_command "$1"
else
eval ${start_cmd}
fi
|