WindChat/stop.sh

34 lines
576 B
Bash
Raw Normal View History

2019-07-29 23:42:16 +08:00
#!/bin/bash
PORT=$1
IS_RESTART=$2
2019-11-27 23:46:00 +08:00
JAVA_JAR="windchat-server"
2019-07-29 23:42:16 +08:00
##set tcp port
if [ -n $PORT ]; then
PORT=2021
fi
2019-11-27 23:43:12 +08:00
echo "[OK] WindChat is closing [PORT:"$PORT"]"
2019-07-29 23:42:16 +08:00
PID=$(ps -ef|grep $JAVA_JAR|grep $PORT |head -1| awk '{printf $2}')
#if [ $? -eq 0 ]; then
if [ $PID ]; then
2019-11-27 23:43:12 +08:00
echo "[OK] WindChat is running on [PID:"$PID"]"
2019-07-29 23:42:16 +08:00
else
2019-11-27 23:43:12 +08:00
echo "[ERROR] WindChat stop failure, as it's not running."
2019-07-29 23:42:16 +08:00
echo ""
exit
fi
kill -9 ${PID}
if [ $? -eq 0 ];then
2019-11-27 23:43:12 +08:00
echo "[OK] WindChat is stoped [PORT:"$PORT" PID:"$PID"]"
2019-07-29 23:42:16 +08:00
else
2019-11-27 23:43:12 +08:00
echo "[ERROR] WindChat stop failure."
2019-07-29 23:42:16 +08:00
fi
echo ""