4 # Required-Start: $local_fs $remote_fs $network $time
5 # Required-Stop: $local_fs $remote_fs $network $time
6 # Default-Start: 2 3 4 5
8 # Short-Description: manage brisk daemon
11 BPATH="xx/home/nastasi/web/brisk"
12 PPATH="xx/home/nastasi/brisk-priv"
16 # seconds to wait exit of the process
25 # scr_old="$(screen -ls | sed "s/^[ ${TB}]*//g;s/[ ${TB}]\+/ /g" | cut -d ' ' -f 1 | grep "\.${SSUFF}$")"
31 # if .pid file exists try to shutdown the process
32 if [ -f "${PPATH}/brisk.pid" ]; then
34 pid_old="$(cat "${PPATH}/brisk.pid")"
36 for i in $(seq 1 $WAITLOOP_MAX); do
38 if ! kill -$sig $pid_old 2>/dev/null ; then
44 if [ $killed -eq 0 ]; then
45 kill -KILL $pid_old 2>/dev/null || true
51 su - ${BUSER} -c 'cd '"$BPATH"'/spush ; ./brisk-spush.php'
55 su - ${BUSER} -c 'cd '"$BPATH"'/spush ; screen -d -m -S '"${SSUFF}"' bash -c '"'"'while [ 1 ]; do cd . ; ./brisk-spush.php \| grep "IN LOOP" ; if [ $? -eq 0 ]; then break ; fi ; done'"'"
63 echo "Usage: $0 {start|stop|restart}" >&2