#!/bin/bash # # warpmud startup script - 2002 Axel Trocha # cd /home/warp while ( : ) do DATE=`date` # # we want cores! # ulimit -c unlimited mv log/syslog log/`date +%Y%m%d-%H%M%S` touch log/syslog ./mud_onboot # # new syslog-entry # echo "$DATE" >> log/syslog # # MUD binary copy-over! # rm code_upgrade 2>/dev/null if [ -r bin/circle1 ]; then cp bin/circle1 bin/circle -rf 2>/dev/null rm bin/circle1 2>/dev/null touch code_upgrade fi # # set a lock which will deleted, when the MUD is up - that enables us to # detect, if the MUD crashes before being compeltely up # touch starting rm shutdown 2>/dev/null # # lets start the mud # echo `date +%Y%m%d-%H%M` started >> uptime.log chgrp warphtml uptime.log sudo ./mud_renice & bin/circle 4000 >> log/syslog 2>&1 # # seems we crashed in the beginning - lets exit and stop the looping # if [ -r starting ]; then echo `date +%Y%m%d-%H%M` nasty startup-crash -- exiting. >> uptime.log exit 1; fi # # shutdown # if [ -r shutdown ]; then echo `date +%Y%m%d-%H%M` shutdown >> uptime.log rm shutdown exit 1; fi # # was it reboot or crash? # if [ -r reboot ]; then echo `date +%Y%m%d-%H%M` rebooted by `cat reboot` >> uptime.log rm lib/core else echo `date +%Y%m%d-%H%M` crash! >> uptime.log if [ -r lib/core ]; then TIM=`date +%Y%m%d-%H%M` mkdir cores/$TIM mv lib/core cores/$TIM cp bin/circle cores/$TIM tail --lines 300 log/syslog > cores/$TIM/syslog cp etc/deb cores/$TIM chgrp warpsrc cores -R chmod g+r cores -R fi fi sleep 10 done