summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2010-05-05 21:53:12 +0200
committermh <mh@immerda.ch>2010-05-05 21:53:12 +0200
commit3cf4f620ea96162e989f883ba65cf09bed29fcb0 (patch)
tree3a6fed2a9bbc7d8f51b0ce4d96cb0a8c483002c1
parent634b02802f6b12925b5818144ed81e06dbc1a0c6 (diff)
improve stunnel init.d script
-rw-r--r--files/CentOS/stunnel.init12
1 files changed, 8 insertions, 4 deletions
diff --git a/files/CentOS/stunnel.init b/files/CentOS/stunnel.init
index 023568b..d5c60fd 100644
--- a/files/CentOS/stunnel.init
+++ b/files/CentOS/stunnel.init
@@ -54,11 +54,15 @@ if [ ! -f $CONF ] ; then
exit 0
fi
+CHROOT=`grep '^chroot' /etc/stunnel/stunnel.conf | head -n 1 | sed 's/ //g' | awk -F= '{ print $2 }'`
+PIDFILE=`grep '^pid' /etc/stunnel/stunnel.conf | head -n 1 | sed 's/ //g' | awk -F= '{ print $2 }'`
+if [ -n "$CHROOT" ]; then
+ PIDFILE=$CHROOT/$PIDFILE
+fi
+
# Path to the lock file.
#
LOCK_FILE=/var/lock/subsys/stunnel
-# pidfile to be used
-pidfile=/var/run/stunnel/stunnel.pid
#====================================================================
@@ -98,7 +102,7 @@ stop() {
else
echo -n $"Shutting down $prog: "
- killproc stunnel
+ killproc -p $PIDFILE stunnel
RETVAL=$?
[ $RETVAL -eq 0 ]
rm -f $LOCK_FILE
@@ -128,7 +132,7 @@ case "$1" in
fi
;;
status)
- status -p $pidfile stunnel
+ status -p $PIDFILE stunnel
RETVAL=$?
;;
*)