packages/net/tor/files/tor.init
nico c6463f8a84 packages/tor{,-alpha}: use new service functions, move user/group creation from postinst to initscript, move pid file to /var/run/tor directory
git-svn-id: svn://svn.openwrt.org/openwrt/packages@28902 3c298f89-4303-0410-b956-a3cf2f4a3e73
2011-11-09 23:17:24 +00:00

30 lines
570 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=50
SERVICE_PID_FILE=/var/run/tor/tor.pid
start() {
user_exists tor 52 || user_add tor 52
group_exists tor 52 || group_add tor 52
[ -d /var/run/tor ] || {
mkdir -m 0755 -p /var/run/tor
chown tor:tor /var/run/tor
}
[ -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
}
stop() {
service_stop /usr/sbin/tor
}