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
|
2021-12-07 16:47:22 +01:00
|
|
|
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 ?
|
2021-12-07 16:47:22 +01:00
|
|
|
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
|
|
|
|
|
2020-06-12 14:02:19 +02:00
|
|
|
if [ "$restart" == "yes" ] && [ "$1" != "stop" ] ; then
|
2019-09-19 13:46:25 +02:00
|
|
|
echo WEBSOCKET = START
|
|
|
|
cd /var/www/html/ninegate
|
2021-12-07 16:47:22 +01:00
|
|
|
systemctl restart wssninegate
|
2019-09-19 13:46:25 +02:00
|
|
|
fi
|