Added SATS.server lock file

This commit is contained in:
xdrm-brackets 2018-01-29 19:04:00 +01:00
parent 591f0beb4f
commit bf3f011bd4
1 changed files with 13 additions and 3 deletions

View File

@ -12,9 +12,15 @@ test $# -lt 1 && echo -e "ERR: Missing argument\n\n\tSATS_ID\tThe id for the bas
# (2) Start server in background (keep PID)
#--------------------------------------------------------#
# (1) Start server #
$ROOT/com/launch sats $1 44441 44440 9999&
SERV_PID=$!;
# (1) Start server (if not already done) #
if [ ! -f $ROOT/sats/.lock ]; then
$ROOT/com/launch sats $1 44441 44440 9999&
SERV_PID=$!;
touch $ROOT/sats/.lock;
fi;
@ -48,6 +54,10 @@ on_exit(){
echo 'sats.server.kill';
kill -9 $SERV_PID 2>/dev/null;
## {4} Delete lock file ##
echo 'sats.server.lock.delete';
rm $ROOT/sats/.lock 2>/dev/null;
exit 0;
}