wvp-gb28181-project/app.sh

57 lines
683 B
Bash

#!/bin/bash
cd $(dirname $0)
exe="java -jar wvp-pro-2.6.9.jar"
arg=""
status(){
count=$(ps aux|grep "$exe"|grep -v grep|wc -l)
if [ $count -eq 0 ] ; then
echo "$exe is stopped"
return
fi
echo "$exe is running"
}
start(){
count=$(ps aux|grep "$exe"|grep -v grep|wc -l)
if [ $count -eq 0 ] ; then
echo "staring $exe"
nohup $exe $arg > nohup.out 2>&1 &
sleep 1
status
exit 0
fi
status
}
stop(){
echo "kill process"
nohup pkill -f "$exe" >/dev/null 2>&1 &
sleep 1
status
}
restart(){
stop
sleep 5
start
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status;;
*)
echo "use $0 start|stop|restart|status"
esac