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; }