Auto Restar

This Aseco flavor by Mistral contains a comprehensive rank system that orders stats by environment, track and author name. It also contains a built-in lottery system.

Moderators: Mistral, TM-Patrol

Post Reply
Furious-Py
highway camper
highway camper
Posts: 2
Joined: 31 May 2009 05:47
Owned TM-games: Nations

Auto Restar

Post by Furious-Py » 31 May 2009 05:50

Hi, my Aseco.sh is shuting down some times, i think there are some errors, whatever it runs really great (when it does)

Is there some script to auto restart the php script when it goes down ?? i try some script but isnt working...

Code: Select all

#!/bin/bash

cd /var/www/trackmania/aseco/

err=1
until [ $err == 0 ]; 
do
  [ -f restart.log ] && mv restart.log "log/`date +%Y-%m-%d_%H-%M-%S`_restart.log"
  ./Aseco.sh  > restart.log 2>&1
  err=$?
  sleep 10;
done

User avatar
Mistral
Pit Crew
Pit Crew
Posts: 1304
Joined: 02 May 2006 15:13
Owned TM-games: tmuf
Contact:

Re: Auto Restar

Post by Mistral » 31 May 2009 07:11

For this i have running a similar watchdog - you just have to adjust the path to aseco.log and the startup commands.

It restarts both ... server and script

Code: Select all

while true; do
	run=`ps -ef | grep -v grep | grep -c TrackmaniaServer`
	if [ $run -eq 0 ] ; then
                tail ~/trackmania/tmu/aseco/aseco.log | awk '{print $0}' >> ~/crash.log
                echo ------------------------------- CRASH ---------------------------- >> ~/crash.log
		mistraltmu start
		echo `date` - TMU SERVER restarted >> ~/restart.log
	fi

	run=`ps -ef | grep -v grep | grep -c aseco.php`
	if [ $run -eq 0 ] ; then
		tail ~/trackmania/tmu/aseco/aseco.log | awk '{print $0}' >> ~/crash.log
		echo ------------------------------- CRASH ---------------------------- >> ~/crash.log 
		mistraltmuaseco start	
		echo `date` - TMU ASECO restarted >> ~/restart.log
	fi

	sleep 30
done

Furious-Py
highway camper
highway camper
Posts: 2
Joined: 31 May 2009 05:47
Owned TM-games: Nations

Re: Auto Restar

Post by Furious-Py » 31 May 2009 20:37

Mistral you are the best :) tks a lot, great script, used with screen :)

:thumbsup: :1

Post Reply