27 lines
589 B
Plaintext
Raw Normal View History

#!/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 $LOG_D ] || ( mkdir -m 0755 -p $LOG_D && chown $RUN_USER:$RUN_GROUP $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)
}