start/stop stunnel
authorroot <root@rsync1.maxxo.com>
Wed, 30 Nov 2011 23:13:49 +0000 (00:13 +0100)
committerroot <root@rsync1.maxxo.com>
Wed, 30 Nov 2011 23:14:03 +0000 (00:14 +0100)
and refactor to make BACKGROUND optional

init.d/_start_stop
init.d/s1-stunnel

index 8018d2e..bec49ec 100755 (executable)
@@ -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` ;;
index ce659fe..4000710 100755 (executable)
@@ -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 $*