Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- logfile="/var/log/trackmania2/failsafe.log"
- function checkIt()
- {
- ps -fu tm2launcher | grep "$1" > /dev/null
- if [ $? != 0 ]
- then
- echo "[ERROR]$(date '+%Y-%m-%d %H:%M:%S'): TM2 $1 server not found, restarting it." >> $logfile;
- if [ $1 == 'stadium' ]; then
- /etc/init.d/trackmania2 restart >> $logfile
- elif [ $1 == '\.rpg\.' ]; then
- /etc/init.d/trackmania2_rpg restart >> $logfile
- elif [ $1 == 'rpgbeg' ]; then
- /etc/init.d/trackmania2_rpg restart beg >> $logfile
- elif [ $1 == 'rpgint' ]; then
- /etc/init.d/trackmania2_rpg restart int >> $logfile
- elif [ $1 == 'rpgadv' ]; then
- /etc/init.d/trackmania2_rpg restart adv >> $logfile
- elif [ $1 == 'rpgexp' ]; then
- /etc/init.d/trackmania2_rpg restart exp >> $logfile
- elif [ $1 == 'rpgprv' ]; then
- /etc/init.d/trackmania2_rpg restart prv >> $logfile
- # elif [ $1 == 'ccpall' ]; then
- # /etc/init.d/trackmania2_ccp restart all >> $logfile
- # elif [ $1 == 'ccpesl' ]; then
- # /etc/init.d/trackmania2_ccp restart esl >> $logfile
- # elif [ $1 == 'ccpalp' ]; then
- # /etc/init.d/trackmania2_ccp restart alp >> $logfile
- fi;
- else
- echo "[OK]$(date '+%Y-%m-%d %H:%M:%S'): TM2 $1 server still running." >> $logfile;
- fi;
- }
- checkIt "stadium";
- checkIt "\.rpg\.";
- checkIt "rpgbeg";
- checkIt "rpgint";
- checkIt "rpgadv";
- checkIt "rpgexp";
- checkIt "rpgprv";
- #checkIt "ccpall";
- #checkIt "ccpesl";
- #checkIt "ccpalp";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement