packages/net/tor/files/tor.init
tripolar 40a979a1c0 [packages] tor: use new procd init script style
Signed-off-by: Peter Wagner <tripolar@gmx.at>


git-svn-id: svn://svn.openwrt.org/openwrt/packages@38135 3c298f89-4303-0410-b956-a3cf2f4a3e73
2013-09-23 10:14:15 +00:00

29 lines
606 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=50
STOP=50
USE_PROCD=1
start_service() {
user_exists tor 52 || user_add tor 52 52 /var/lib/tor
group_exists tor 52 || group_add tor 52
[ -f /var/run/tor.pid ] || {
touch /var/run/tor.pid
chown tor:tor /var/run/tor.pid
}
[ -d /var/lib/tor ] || {
mkdir -m 0755 -p /var/lib/tor
chmod 0700 /var/lib/tor
chown tor:tor /var/lib/tor
}
[ -d /var/log/tor ] || {
mkdir -m 0755 -p /var/log/tor
chown tor:tor /var/log/tor
}
procd_open_instance
procd_set_param command /usr/sbin/tor --runasdaemon 0
procd_close_instance
}