packages/net/tor/files/tor.init
jow 70c123b68e [packages] tor: update to v0.2.1.21 (#6391)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@18888 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-12-22 12:28:06 +00:00

27 lines
540 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=50
BIN=tor
DEFAULT=/etc/default/$BIN
LOG_D=/var/log/$BIN
LIB_D=/var/lib/$BIN
RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
RUN_USER=$BIN
RUN_GROUP=$BIN
start() {
[ -f $DEFAULT ] && . $DEFAULT
[ -d $LIB_D ] || mkdir -p $LOG_D
[ -d $LIB_D ] || ( mkdir -m 0700 -p $LIB_D && chown $RUN_USER:$RUN_GROUP $LIB_D )
[ -d $RUN_D ] || mkdir -p $RUN_D
[ -f $PID_F ] || ( touch $PID_F && chown $RUN_USER:$RUN_GROUP $PID_F )
$BIN $OPTIONS
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}