-
Notifications
You must be signed in to change notification settings - Fork 2
/
nightrun
41 lines (30 loc) · 811 Bytes
/
nightrun
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
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/csh
# starter dmserver op til 10 gange, eller s}l{nge status != 0.
set max=10
set counter=0
echo "*** Nightrun started by $user at:" >> runlog
date >> runlog
tail -3 syslog >> runlog
mv syslog syslog.old
grep killed syslog.old >> lib/dead_log
if (! -e lib/core) then
touch lib/core
chmod ug+r lib/core
endif
echo "Nightrun started by $USER at `date`." > syslog
while 1
@ counter = ($counter + 1)
echo "************* DIKUMUD REBOOT -- Run nr $counter *********" >> syslog
dmserver >>& syslog
set tmp=$status
if (($tmp == 0) || ($counter == $max)) then
echo "Nightrun terminating (after run nr $counter)." >> syslog
exit
endif
if ($tmp == 52) then
set counter=0
mv syslog syslog.old
endif
echo "Nightrun ($user) restarting game at `date`." >> runlog
tail -3 syslog >> runlog
end