summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rwxr-xr-xutils/bs-tester.sh30
-rwxr-xr-xutils/daemon.sh18
-rwxr-xr-xutils/hellow-tester.sh30
-rwxr-xr-xutils/jfsck.sh10
-rwxr-xr-xutils/setenv.sh5
5 files changed, 93 insertions, 0 deletions
diff --git a/utils/bs-tester.sh b/utils/bs-tester.sh
new file mode 100755
index 0000000..1c21841
--- /dev/null
+++ b/utils/bs-tester.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# tester.sh - tests whether or not the judge is working properly without web
+# Copyright (C) 2012 Hamed Saleh and Mahrud Sayrafi
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+echo -1 \
+ admin \
+ bs \
+ cpp \
+ $JUDGE_PREFIX/problems/bs/bs.cpp \
+ 0 | #FIXME: what was this?! guess smt like whether or not break on wrong
+ nc -vv 127.0.0.1 31415
+
+sleep 2 # Ladies and gentlemen, please wait for the jury to make its decision!
+
+tail -n3 $JUDGE_PREFIX/log/error.log # in case there are some errors, they are here!
+tail -n1 $JUDGE_PREFIX/log/grading.log # and there you go! the final decision!
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 &
diff --git a/utils/hellow-tester.sh b/utils/hellow-tester.sh
new file mode 100755
index 0000000..db39c93
--- /dev/null
+++ b/utils/hellow-tester.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# tester.sh - tests whether or not the judge is working properly without web
+# Copyright (C) 2012 Hamed Saleh and Mahrud Sayrafi
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+echo -1 \
+ admin \
+ hellow \
+ cpp \
+ $JUDGE_PREFIX/problems/hellow/hellow.cpp \
+ 0 | #FIXME: what was this?! guess smt like whether or not break on wrong
+ nc -vv 127.0.0.1 31415
+
+sleep 2 # Ladies and gentlemen, please wait for the jury to make its decision!
+
+tail -n3 $JUDGE_PREFIX/log/error.log # in case there are some errors, they are here!
+tail -n1 $JUDGE_PREFIX/log/grading.log # and there you go! the final decision!
diff --git a/utils/jfsck.sh b/utils/jfsck.sh
new file mode 100755
index 0000000..3e53a56
--- /dev/null
+++ b/utils/jfsck.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+exec 2>/dev/null
+
+kill `cat $JUDGE_PREFIX/judge.pid`
+sleep 1
+kill -s 9 `cat /var/run/judgeinit.lock0`
+kill -s 9 `cat $JUDGE_PREFIX/judge.pid`
+
+echo hasta la vista, baby! :-t
diff --git a/utils/setenv.sh b/utils/setenv.sh
new file mode 100755
index 0000000..aa6865f
--- /dev/null
+++ b/utils/setenv.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+JUDGE_PREFIX=~/hellijudge-legacy
+
+echo JUDGE_PREFIX=$JUDGE_PREFIX >> ~/.bash_profile