diff options
Diffstat (limited to 'net/tor/files/tor.in')
-rw-r--r-- | net/tor/files/tor.in | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/net/tor/files/tor.in b/net/tor/files/tor.in new file mode 100644 index 00000000000..56ea5fb0224 --- /dev/null +++ b/net/tor/files/tor.in @@ -0,0 +1,44 @@ +#!@RCD_SCRIPTS_SHELL@ +# +# $NetBSD: tor.in,v 1.1 2005/02/13 20:27:54 jschauma 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="/var/run/${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 |