oki guys, heres next try for restarting the gameserver in the case it dont answer properly.
it is (thx xtj7) a little php script that use rcon protocol for querying the gameserver status (like hlsw etc)
if the answer dont contain "statusResponse", the restart batch will kill the server via taskkill and start it again.
thats the checking script
Code:
<?php
$fp = fsockopen( 'udp://127.0.0.1', 22222, $errno, $error, 1 );
fwrite( $fp, "xFFxFFxFFxFFgetstatusx00" );
if( $fp && strpos( fgets( $fp, 2048 ), "statusResponse" ) ) {
echo( 'Server alive' );
} else {
echo( 'Server died' );
system( "C:/gameservers/UrbanTerror/ForceRestart.bat && exit", $output );
echo( 'Attempting restart...' );
}
?>
...and thats the C:/gameservers/UrbanTerror/ForceRestart.bat
Code:
taskkill /F /IM ioUrTded.exe
taskkill /F /IM python.exe
C:gameserversUrbanTerror22222.bat
sendemail -f gameserver@dswp.de -s xxx.xxx.xxx.xxx:225 -t lol@huhu -t spam@me.com -u huhu -m omg i did it again.
ah 2 notes:
-allways be sure to remember the save mode before use
exec(),
passthru() or
system()-sendemail.exe command line mail client can be found free at
http://www.caspian.dotconf.net/menu/Software/SendEmail/-be patient for the case our little "sylvesterknaller" has a littel "new-years-eve-backfire-issues"
gg