Apply Roger's bug 1269 fix.
[tor/rransom.git] / contrib / rc.subr
blob117ae71d472fa76ffe9fa047052a24dc4a9d7c5f
1 #!/bin/sh
2 # $Id$
3 # $FreeBSD: ports/security/tor-devel/files/tor.in,v 1.1 2006/02/17 22:21:25 mnag Exp $
5 # (rc.subr written by Peter Thoenen for Net/FreeBSD)
7 # REQUIRE: NETWORKING SERVERS USR
8 # BEFORE: LOGIN
10 # Add the following lines to /etc/rc.conf to enable tor
12 # tor_enable (bool): Set to "NO" by default
13 # Set it to "YES" to enable tor
14 # tor_conf (str): Points to your tor conf file
15 # Default: /usr/local/etc/tor/torrc
16 # tor_user (str): Tor Daemon user. Default _tor
19 . /etc/rc.subr
21 name="tor"
22 rcvar=${name}_enable
24 load_rc_config ${name}
26 : ${tor_enable="NO"}
27 : ${tor_conf="/usr/local/etc/tor/torrc"}
28 : ${tor_user="_tor"}
29 : ${tor_pidfile="/var/run/tor/tor.pid"}
30 : ${tor_logfile="/var/log/tor"}
31 : ${tor_datadir="/var/run/tor"}
33 required_files=${tor_conf}
34 required_dirs=${tor_datadir}
35 command="/usr/local/bin/${name}"
36 command_args="-f ${tor_conf} --pidfile ${tor_pidfile} --runasdaemon 1 --datadirectory ${tor_datadir} --user ${tor_user}"
37 extra_commands="log"
38 log_cmd="${name}_log"
40 tor_log() {
41 cat ${tor_logfile}
44 run_rc_command "$1"