From eebeed4bc03eaf0b5f08ff3ce4c1d1cea40b9521 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 1 Dec 2011 00:13:49 +0100 Subject: [PATCH 1/1] start/stop stunnel and refactor to make BACKGROUND optional --- init.d/_start_stop | 11 +++++++++-- init.d/s1-stunnel | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/init.d/_start_stop b/init.d/_start_stop index 8018d2e..bec49ec 100755 --- a/init.d/_start_stop +++ b/init.d/_start_stop @@ -1,9 +1,16 @@ +BACKGROUND=1 + _start_stop() { case $1 in start) - cd /srv/cloudstore && ( $DAEMON 2>&1 ) > /tmp/$NAME.log & - echo $! > /tmp/$NAME.pid + cd /srv/cloudstore + if [ "$BACKGROUND" -eq 1 ] ; then + ( $DAEMON 2>&1 ) > /tmp/$NAME.log & + echo $! > /tmp/$NAME.pid + else + $DAEMON + fi ;; stop) kill `cat /tmp/$NAME.pid` ;; diff --git a/init.d/s1-stunnel b/init.d/s1-stunnel index ce659fe..4000710 100755 --- a/init.d/s1-stunnel +++ b/init.d/s1-stunnel @@ -3,8 +3,8 @@ . /srv/cloudstore/init.d/_start_stop BACKGROUND=0 -NAME=s1-rsync-piper -DAEMON="stunnel -c -d 213.186.16.27:443 -r 127.0.0.1:6501 -P /tmp/$NAME.pid" +NAME=s1-stunnel +DAEMON="/usr/bin/stunnel -c -d 213.186.16.27:443 -r 127.0.0.1:6501 -P /tmp/$NAME.pid -o /tmp/$NAME.log" _start_stop $* -- 2.20.1