Aseco restart helper

This forum is dedicated to the Aseco/Rasp 2 server records and control script by Flo and Assembler Maniac. Announcements and issues can be discussed in this forum.

Moderators: Flo, Assembler Maniac, f*ckfish, TM-Patrol

Post Reply
Ch3ck3r
cyclist
cyclist
Posts: 31
Joined: 14 Apr 2008 17:38
Owned TM-games: TMS, TMSX, TMU, TMUF
Location: Germany|Berlin|Berlin
Contact:

Aseco restart helper

Post by Ch3ck3r » 16 Sep 2008 15:24

Hey guys,
I think a lot of you buddies know the problem that aseco has with servers with a lot of players on it.
Aseco just "wants" to shut down some times. So it just kills itself some times due to some error occuring with so many players.

At our server this is often XMLRPC connection error (don't know why) and often it is LOGIN UNKNOWN error and then aseco shuts down (occuring if somebody leaves in the exact same moment as aseco wants to display him something or does something that is related to this user.

Because we can't (of course) be on the server everytime to check aseco i got an idea.
So i sat down yesterday and build a little python script that checks whether aseco is running every 60 seconds (actually this is configurable).
If aseco crashed it starts aseco again in between podium mode and next map (while you are loading the next map). I noticed this is best time to start aseco
because no heavy action takes place that aseco needs to handle.

WARNING:
I do not promise that this works / ABSOLUTELY NO WARRANTY.
ALSO: If you run more then one aseco on the same server (for example 2 servers with each 1 aseco) this doesn't work anymore!!!!!!!

So there is the code

asecocheck.py

Code: Select all

import Gbx
import time
import os
import subprocess
import time

""" CONFIGURATION """

pathToAseco = "/home/user/aseco" # YOU MUST SPECIFY THE ABSOLUTE PATH! (Folder where Aseco.sh is in)
pathToAsecoCheck = "/home/user/tools" # YOU MUST SPECIFY THE ABSOLUTE PATH! (Folder where this script is in)
superAdminPass = "SuperAdmin" # YOUR SUPERADMIN LOGIN
port = 5000 # YOUR XML RPC PORT

""" CONFIGURATION END """

def restartAseco(code, name):
    global pathToAseco, pathToAsecoCheck, endTick
	if code == 2:
		os.system("cd "+pathToAseco+";sh Aseco.sh")
		print "Aseco restarted"
		time.sleep(80)
		os.system("cd "+pathToAsecoCheck+";screen -dmS checker python asecocheck.py")
		sys.exit(1);
		endTick = True

print "starting asecocheck"
endTick = False
xml = '\
<?xml version="1.0" encoding="utf-8" ?>\
<manialink id="998">\
<quad posn="-45 30 9" sizen="90 30" style="Bgs1" substyle="BgListLine" />\
<label posn="-43 28 10" text="$e00$w$oDetected Aseco error" align="center" halign="left" />\
<label posn="-36 24 10" text="$000Automatic aseco safety system noticed aseco crash!\n\
Trying to restart Aseco in between podium mode and next map.\n\
\n\
We are sorry about this error." align="center" halign="left" />\
<label posn="-25 2 10" text="OK" align="center" halign="left" style="CardButtonMediumWide" action="90000" />\
</manialink>\
'

while True:
	processes = os.popen("ps ax | grep aseco.php | grep -v grep").read()
	print "checking..."
	if len(processes.split("\n")) != 2:
		print "aseco malfunction detected"
		print "informing about on server"
		c = Gbx.Client("localhost:"+str(port))
		c.init()
		c.Authenticate("SuperAdmin", superAdminPass)
		c.SendDisplayManialinkPage(xml, 0, True)
		c.EnableCallbacks(True)
		c.add_method("TrackMania.StatusChanged", restartAseco)
		print "Wating to restart aseco"
		while True:
			c.tick(0.1)
			if endTick:
				break
		c.release()
		endTick = False
	else:
		print "aseco is running..."
	time.sleep(60)
you need the following file in the same directory as well:
http://www.ch3ck3r.org/downloads/Gbx.py

Have fun, i hope this helps someone.

User avatar
w1lla
TM-Patrol
TM-Patrol
Posts: 1466
Joined: 23 May 2007 07:20
Owned TM-games: TMU, TMN, TMF
Manialink(s): intr
Location: Venray

Re: Aseco restart helper

Post by w1lla » 16 Sep 2008 16:41

Code: Select all

XMLRPC Error [-1000] - Login unknown. 
Given this code it also should give an error message were aseco crashed on please provide more details so all of us that use this program can help together and make the crash stop.

Code: Select all

tmnforever is nations and united makes it special. tmnforever has united. I need united!

Post Reply