启动:
#!/bin/sh
APP_NAME="xy-pay-main"
JAVA_OPT="-Xmx1024m"
#has started
tpid=`ps -ef|grep ${APP_NAME}|grep -v grep|grep -v kill|awk '{print $2}'`
if [[ ${tpid} ]]; then
echo "error: ${APP_NAME} has started"
exit 1
fi
rm -f tpid
nohup java ${JAVA_OPT} -jar "${APP_NAME}.jar" > nohup.out 2>&1 &
echo $! > tpid
echo Start Success!
停止:
#!/bin/sh
APP_NAME="xy-pay-main"
tpid=`ps -ef|grep ${APP_NAME}|grep -v grep|grep -v kill|awk '{print $2}'`
if [[ ${tpid} ]]; then
echo 'Stop Process...'
kill -15 ${tpid}
else
echo "error: ${APP_NAME} not found"
exit 1
fi
sleep 5
tpid=`ps -ef|grep ${APP_NAME}|grep -v grep|grep -v kill|awk '{print $2}'`
if [[ ${tpid} ]]; then
echo 'Kill Process!'
kill -9 ${tpid}
else
echo 'Stop Success!'
fi