and refactor to make BACKGROUND optional
+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` ;;
. /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 $*