summaryrefslogtreecommitdiff
path: root/etc/init.d
diff options
context:
space:
mode:
Diffstat (limited to 'etc/init.d')
-rwxr-xr-xetc/init.d/uanytun16
1 files changed, 9 insertions, 7 deletions
diff --git a/etc/init.d/uanytun b/etc/init.d/uanytun
index 07cb448..db1dc47 100755
--- a/etc/init.d/uanytun
+++ b/etc/init.d/uanytun
@@ -13,6 +13,7 @@ DAEMON=/usr/sbin/uanytun
CONFIG_DIR=/etc/uanytun
NAME=uanytun
DESC=uanytun
+VARRUN_DIR=/var/run/$NAME
test -x $DAEMON || exit 0
@@ -30,8 +31,9 @@ start_vpn () {
if [ -n "$CHROOTDIR" ] ; then
test -d $CHROOTDIR || mkdir -p $CHROOTDIR
fi
+ test -d $VARRUN_DIR || mkdir -p $VARRUN_DIR
DAEMONARG=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e '\w' | sed 's/^/--/' | tr '\n' ' '`
- $DAEMON --write-pid /var/run/uanytun.$NAME.pid $POSTUP $DAEMONOPTS $DAEMONARG || STATUS="FAILED"
+ $DAEMON --write-pid $VARRUN_DIR/$NAME.$NAME.pid $POSTUP $DAEMONOPTS $DAEMONARG || STATUS="FAILED"
else
STATUS="no config found"
fi
@@ -69,7 +71,7 @@ case "$1" in
stop)
echo -n "Stoping $DESC:"
if test -z "$2" ; then
- for PIDFILE in `ls /var/run/uanytun.*.pid 2> /dev/null`; do
+ for PIDFILE in `ls $VARRUN_DIR/$NAME.*.pid 2> /dev/null`; do
NAME=`echo $PIDFILE | cut -c18-`
NAME=${NAME%%.pid}
echo -n " $NAME"
@@ -78,8 +80,8 @@ case "$1" in
else
while shift ; do
[ -z "$1" ] && break
- if test -e /var/run/uanytun.$1.pid ; then
- PIDFILE=`ls /var/run/uanytun.$1.pid 2> /dev/null`
+ if test -e $VARRUN_DIR/$NAME.$1.pid ; then
+ PIDFILE=`ls $VARRUN_DIR/$NAME.$1.pid 2> /dev/null`
NAME=`echo $PIDFILE | cut -c18-`
NAME=${NAME%%.pid}
echo -n " $NAME"
@@ -94,7 +96,7 @@ case "$1" in
reload)
echo -n "Reloading $DESC:"
if test -z "$2" ; then
- for PIDFILE in `ls /var/run/uanytun.*.pid 2> /dev/null`; do
+ for PIDFILE in `ls $VARRUN_DIR/$NAME.*.pid 2> /dev/null`; do
NAME=`echo $PIDFILE | cut -c18-`
NAME=${NAME%%.pid}
echo -n " $NAME"
@@ -104,8 +106,8 @@ case "$1" in
else
while shift ; do
[ -z "$1" ] && break
- if test -e /var/run/uanytun.$1.pid ; then
- PIDFILE=`ls /var/run/uanytun.$1.pid 2> /dev/null`
+ if test -e $VARRUN_DIR/$NAME.$1.pid ; then
+ PIDFILE=`ls $VARRUN_DIR/$NAME.$1.pid 2> /dev/null`
NAME=`echo $PIDFILE | cut -c18-`
NAME=${NAME%%.pid}
echo -n " $NAME"