#!/bin/bash
APP_HOME=/wdcloud/app/rps/rps-module-admin
APP_JAR=rps-module-admin-*.jar
APP_PIDS=$(ps ax | grep java | grep $APP_HOME | grep -v grep | awk '{print $1}')
function start(){
if [ -z "$APP_PIDS" ]; then
echo "start project..."
exec java -jar $APP_HOME/$APP_JAR >/dev/null 2>&1 &
echo "start project end..."
else
echo "warning: the spring boot server is started!!!====="$APP_HOME
exit 1
fi
}
function stop(){
if [ -z "$APP_PIDS" ]; then
echo "No spring boot server to stop"
else
echo "stop project..."
kill -s TERM $APP_PIDS
echo "stop project end..."
fi
}
function restart(){
stop
sleep 3
APP_PIDS=$(ps ax | grep java | grep $APP_HOME | grep -v grep | awk '{print $1}')
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
printf 'Usage: %s {start|stop|restart}
' "$prog"
;;
esac
exit 1