-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathautorun
More file actions
executable file
·64 lines (58 loc) · 1.6 KB
/
autorun
File metadata and controls
executable file
·64 lines (58 loc) · 1.6 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
CIRCLE=${CIRCLE:-build/circle}
ulimit -c unlimited
umask u=rwx,g=rwx,o=
export ASAN_OPTIONS=log_path=/home/mud/mud/asan.log
# Parse -d <world_dir> from arguments to find board files
WORLD_DIR="lib"
args=("$@")
for (( i=0; i<${#args[@]}; i++ )); do
if [ "${args[$i]}" = "-d" ]; then
WORLD_DIR="${args[$((i+1))]}"
break
fi
done
BOARD_DIR="$WORLD_DIR/etc/board"
CIRCLE_PID=""
trap 'kill $CIRCLE_PID 2>/dev/null; exit' TERM INT
#############################################################################
while ( : ) do
DATE=`date`
echo "autorun starting game $DATE" >> syslog
echo "running $CIRCLE $@" >> syslog
chmod 660 "$BOARD_DIR"/* 2>/dev/null || true
$CIRCLE "$@" >>sd.out &
CIRCLE_PID=$!
wait $CIRCLE_PID
mv syslog.CRASH.1 syslog.CRASH.2
mv syslog.CRASH syslog.CRASH.1
tail -1000 syslog > syslog.CRASH
fgrep "self-delete" syslog >> log/delete
fgrep "killed" syslog >> log/rip
fgrep "Running" syslog >> log/restarts
fgrep "advanced" syslog >> log/levels
fgrep "equipment lost" syslog >> log/rentgone
fgrep "Create new player" syslog >> log/newplayers
fgrep "SYSERR" syslog >> log/errors
fgrep "(GC)" syslog >> log/godcmds
fgrep "Bad PW" syslog >> log/badpws
bzip2 syslog
rm syslog
mv syslog.bz2 archive/syslog.$(date +%d%m%y-%H%M%S).bz2
mv core.2 core.3
mv core.1 core.2
mv "$WORLD_DIR"/core* core.1 2>/dev/null || true
chmod 660 core.1
if [ -r .killscript ]; then
DATE=`date`;
echo "autoscript killed $DATE" >>syslog
rm .killscript
exit
fi
if [ ! -r .fastboot ]; then
sleep 30
else
rm .fastboot
sleep 5
fi
done