aboutsummaryrefslogtreecommitdiff
path: root/tools/boca-submit-run-cron
blob: 81ff6a23b7d35aa924561ff154ca210d7e84b3ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

if [ "`id -u`" != "0" ]; then
  echo "Must be run as root"
  exit 1
fi

if [ -d /root/submissions ]; then
    touch /root/submissions/placeholder.bocarun
    runaux=/usr/bin/boca-submit-run-aux
    if [ ! -f "$runaux" ]; then
	echo "Error: could not find aux script"
    else
	for i in `ls /root/submissions/*.bocarun`; do
		if [ "$i" != "/root/submissions/placeholder.bocarun" ]; then
			$runaux "$i" > ${i}.result
			res=$?
			if [ "$res" == "2" ]; then
				echo "time-out - this will automatically retry soon" > ${i}.result
			fi
			if [ "$res" == "0" ]; then
				mv "$i" "${i}.processed"
			fi
		fi
	done
    fi
fi