gestion websocket server

This commit is contained in:
2019-09-19 13:46:25 +02:00
parent 4b0d392e58
commit 1f3f2246fd
9 changed files with 183 additions and 27 deletions

View File

@ -3,11 +3,24 @@ websocket_url=$(CreoleGet adresse_ip_eth0 non)
websocket_portinterne=$(CreoleGet ninegate_websocket_portinterne non)
# Server Websocket
echo WEBSOCKET = STOP
pid="$(pgrep -f gos:websocket)"
if [ -n "${pid}" ]; then
kill -9 ${pid};
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
fi
echo WEBSOCKET = START
bin/console gos:websocket:server --port $websocket_portinterne -a $websocket_url --no-debug -n -q --env=prod & disown
# 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