nico 9e91f230fd packages/tor{,-alpha}: use a fixed predictable pid-file location (patch from Peter Wagner), remove PidFile config entry
git-svn-id: svn://svn.openwrt.org/openwrt/packages@29177 3c298f89-4303-0410-b956-a3cf2f4a3e73
2011-11-16 09:44:20 +00:00

31 lines
602 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=50
STOP=50
SERVICE_USE_PID=1
start() {
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
}
service_start /usr/sbin/tor --PidFile /var/run/tor.pid
}
stop() {
service_stop /usr/sbin/tor
}