2019-07-23 15:32:35 +02:00
|
|
|
#!/bin/bash
|
|
|
|
websocket_url=$(CreoleGet adresse_ip_eth0 non)
|
|
|
|
websocket_portinterne=$(CreoleGet ninegate_websocket_portinterne non)
|
|
|
|
|
|
|
|
# Server Websocket
|
2019-09-19 13:46:25 +02:00
|
|
|
if [[ "$1" != "restartifdown" ]]; then
|
|
|
|
echo WEBSOCKET = STOP
|
|
|
|
pid="$(pgrep -a -f gos:websocket | grep $websocket_portinterne)"
|
|
|
|
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 $websocket_portinterne)"
|
|
|
|
restart="yes"
|
|
|
|
if [ "$1" == "restartifdown" ] && [ -n "${pid}" ] ; then
|
|
|
|
restart="no"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$restart" == "yes" ]]; then
|
|
|
|
echo WEBSOCKET = START
|
|
|
|
cd /var/www/html/ninegate
|
|
|
|
bin/console gos:websocket:server --port $websocket_portinterne -a $websocket_url --no-debug -n -q --env=prod & disown
|
|
|
|
fi
|