From bf3f011bd4d719a7d282820fe8f1ab151581e9c6 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 29 Jan 2018 19:04:00 +0100 Subject: [PATCH] Added SATS.server lock file --- sats/main | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sats/main b/sats/main index 1eaf0ad..4c1bb89 100644 --- a/sats/main +++ b/sats/main @@ -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; }