new file: makefile
[GalaxyCodeBases.git] / bash / etc / runserv.sh
blob8faa5f6b412337f94f76f36c80599c3b1e4694b5
1 #!/bin/bash
3 DIR=$(/usr/bin/dirname "${0}")
5 mystart ()
7 cd ${DIR}
8 php -q bgprocess.php </dev/null >logfile.log &
9 echo $! > bg.pid
12 case "$1" in
13 start)
14 mystart
16 stop)
17 cd ${DIR}
18 mypid=`cat bg.pid`
19 var2=`ps xu | grep $mypid | wc -l`
20 if [ "$var2" -gt 0 ]
21 then
22 kill $mypid
25 check)
26 # check if the process is running.
27 cd ${DIR}
28 mypid=`cat bg.pid`
29 var2=`ps xu | grep $mypid | wc -l`
30 if [ "$var2" -lt 1 ]
31 then
32 mystart
35 esac
37 exit 0;