From 0651913426e219eb68444f745a93e4ab53738121 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 28 Jan 2018 13:46:53 +0100 Subject: [PATCH] created ioemu.daemon (+ added subgit 'bash-socket') -> connection establishment OK --- ioemu/com | 1 + ioemu/daemon | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 160000 ioemu/com create mode 100755 ioemu/daemon diff --git a/ioemu/com b/ioemu/com new file mode 160000 index 0000000..08f30d2 --- /dev/null +++ b/ioemu/com @@ -0,0 +1 @@ +Subproject commit 08f30d29965fb90d9037fd4645799d9b6da2c3ef diff --git a/ioemu/daemon b/ioemu/daemon new file mode 100755 index 0000000..69098f8 --- /dev/null +++ b/ioemu/daemon @@ -0,0 +1,32 @@ +#!/bin/bash + + +# (1) Primary init. +#--------------------------------------------------------# +# (1) Get absolute folder # +ROOT=$(dirname `realpath $0`); + +# (2) Check required arguments +test $# -lt 1 && echo -e "ERR: Missing argument\n\n\tSATS_IP\tThe ip for the SATS system\n" && exit 1; +SATS_IP=$1; + +# (3) Check lock file # +test -f $ROOT/.lock && echo "Daemon already started ($ROOT/.lock)" && exit 1; +touch $ROOT/.lock; + + + +# (2) Set traps before starting any subproccess +#--------------------------------------------------------# +trap "kill -9 $SERV_PID 2>/dev/null; pkill nc 2>/dev/null; rm $ROOT/.lock 2>/dev/null; exit 1;" INT; +trap "kill -9 $SERV_PID 2>/dev/null; pkill nc 2>/dev/null; rm $ROOT/.lock 2>/dev/null; exit 1;" KILL; + + + +# (3) Wait for trigger to launch server +#--------------------------------------------------------# +# (1) Wait for trigger # +$ROOT/com/trigger 9999; + +# (2) Launch server in background # +$ROOT/com/launch ioemu $SATS_IP 44440 44441 & \ No newline at end of file