aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-03-08 07:30:07 +0000
committerNick Mathewson <nickm@torproject.org>2006-03-08 07:30:07 +0000
commit6f6bbc6f912ad297e03da19c9fd68cfcb9617135 (patch)
tree7f55a1df6fe3116fb109be01aaf6c6cb1b2cd581
parentcf4809258ebe59bf2fe8d701d4e538858fd39451 (diff)
downloadtor-6f6bbc6f912ad297e03da19c9fd68cfcb9617135.tar
tor-6f6bbc6f912ad297e03da19c9fd68cfcb9617135.tar.gz
Add rc.subr from Peter Thoenen. I have no idea what an rc.subr is, but apparently BSD people do. (Closing bug 256.)
svn:r6097
-rw-r--r--contrib/rc.subr46
1 files changed, 46 insertions, 0 deletions
diff --git a/contrib/rc.subr b/contrib/rc.subr
new file mode 100644
index 000000000..8852b6046
--- /dev/null
+++ b/contrib/rc.subr
@@ -0,0 +1,46 @@
+#!/bin/sh
+# $Id$
+# $FreeBSD: ports/security/tor-devel/files/tor.in,v 1.1 2006/02/17 22:21:25 mnag Exp $
+#
+# (rc.subr written by Peter Thoenen for Net/FreeBSD)
+#
+# REQUIRE: NETWORKING SERVERS USR
+# BEFORE: LOGIN
+#
+# Add the following lines to /etc/rc.conf to enable tor
+#
+# tor_enable (bool): Set to "NO" by default
+# Set it to "YES" to enable tor
+# tor_conf (str): Points to your tor conf file
+# Default: /usr/local/etc/tor/torrc
+# tor_user (str): Tor Daemon user. Default _tor
+# tor_groupr (str): Tor Daemon group. Default _tor
+#
+
+. /etc/rc.subr
+
+name="tor"
+rcvar=${name}_enable
+
+load_rc_config ${name}
+
+: ${tor_enable="NO"}
+: ${tor_conf="/usr/local/etc/tor/torrc"}
+: ${tor_user="_tor"}
+: ${tor_group="_tor"}
+: ${tor_pidfile="/var/run/tor/tor.pid"}
+: ${tor_logfile="/var/log/tor"}
+: ${tor_datadir="/var/run/tor"}
+
+required_files=${tor_conf}
+required_dirs=${tor_datadir}
+command="/usr/local/bin/${name}"
+command_args="-f ${tor_conf} --pidfile ${tor_pidfile} --runasdaemon 1 --datadirectory ${tor_datadir} --user ${tor_user} --group ${tor_group}"
+extra_commands="log"
+log_cmd="${name}_log"
+
+tor_log() {
+ cat ${tor_logfile}
+}
+
+run_rc_command "$1"