#!/bin/bash # # ZDaemon Server invokation script with auto-recovery, # crash logging and an upper crash limit. # # Copyright (C) 2003-11, The ZDaemon Team # # IMPORTANT: this script NEEDS bash: it will NOT work # with other shells that behave somewhat like bash. If # you want it to run it under BSD, MAKE SURE you have # bash installed. ######################################################## CRASHCOUNT=0 MAXCRASH=100 ulimit -c 0 cd /opt/zdaemon/zserv1 while (true) do ./zserv -port 10601 -noinput -iwad /opt/zdaemon/wads/doom2.wad -file /opt/zdaemon/wads/classix.wad < /dev/null > /dev/null 2>&1 & PID=$! trap "kill -15 $PID; exit 0" 15 wait echo `date '+%Y-%m-%d %H:%M:%S'` : zserv crash >> zserv.crashlog CRASHCOUNT=`expr $CRASHCOUNT + 1` if [ $CRASHCOUNT -ge $MAXCRASH ]; then break; fi sleep 2 done