+# by default, detach from terminal
BACKGROUND=1
+# deduce name from script name
+NAME=`basename $0`
+# generate ZSLICE and SLICE from group name
+export SLICE_GROUP=`echo $NAME | cut -d\- -f1`
+export SLICE=`grep $SLICE_GROUP /var/lib/extrausers/group | cut -d: -f2`
+export ZSLICE=`echo $SLICE | sed 's;^/;;'`
_start_stop() {
start)
cd /srv/cloudstore
if [ "$BACKGROUND" -eq 1 ] ; then
- ( $DAEMON 2>&1 ) > /tmp/$NAME.log &
+ ( $DAEMON 2>&1 ) >> $SLICE/log/$NAME.log &
echo $! > /tmp/$NAME.pid
else
$DAEMON
fi
;;
stop)
- kill `cat /tmp/$NAME.pid` ;;
+ kill `cat /tmp/$NAME.pid`
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
*)
- echo "usage: $0 {start|stop}" ;;
+ echo "usage: $0 {start|stop|restart}" ;;
esac
exit 0