summaryrefslogtreecommitdiffstats
path: root/utils/daemon.sh
diff options
context:
space:
mode:
Diffstat (limited to 'utils/daemon.sh')
-rwxr-xr-xutils/daemon.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/utils/daemon.sh b/utils/daemon.sh
new file mode 100755
index 0000000..ab1d24f
--- /dev/null
+++ b/utils/daemon.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+LOCK=$JUDGE_PREFIX/judge.pid #FIXME
+
+if [ -e $LOCK ]
+then
+ PID=`cat $LOCK`
+
+ if ps $PID >/dev/null
+ then
+ echo "Daemon is already running and it's PID is $PID." >&2
+ exit 1
+ else
+ rm -f $LOCK
+ fi
+fi
+
+sh $JUDGE_PREFIX/base/daemon.sh &>> $JUDGE_PREFIX/log/error.log &