ninegate/src/ninegate-1.0/scripts/ninegate-websocket.sh

24 lines
565 B
Bash
Raw Normal View History

2019-07-23 15:32:35 +02:00
#!/bin/bash
# Server Websocket
2019-09-19 13:46:25 +02:00
if [[ "$1" != "restartifdown" ]]; then
echo WEBSOCKET = STOP
pid="$(pgrep -a -f gos:websocket | grep 5556)"
2019-09-19 13:46:25 +02:00
if [ -n "${pid}" ]; then
IFS=' ' read -r -a array <<< "$pid"
kill -9 ${array[0]};
fi
2019-07-23 15:32:35 +02:00
fi
2019-09-19 13:46:25 +02:00
# Port LISTEN ?
pid="$(pgrep -a -f gos:websocket | grep 5556)"
2019-09-19 13:46:25 +02:00
restart="yes"
if [ "$1" == "restartifdown" ] && [ -n "${pid}" ] ; then
restart="no"
fi
if [ "$restart" == "yes" ] && [ "$1" != "stop" ] ; then
2019-09-19 13:46:25 +02:00
echo WEBSOCKET = START
cd /var/www/html/ninegate
systemctl restart wssninegate
2019-09-19 13:46:25 +02:00
fi