search -  faq -  rulez -  staff

forums






map cycle
irc              pwnalizer
voice         dswp bar




Register

Login


It is currently 12.22.24

 

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: automatic server restart
PostPosted: 12.27.08 
Offline
Godlike
User avatar

Joined: 07.15.08
Posts: 4648
Location: Behind U
-----tdm:  
nick: [dswp]GewitterOma
skill: 1122.83
kills: 25960
deaths: 19847
ratio: 1.30
-----bomb:  
nick: [dswp]GewitterOma
skill: 812.172
kills: 3885
deaths: 3541
ratio: 1.09
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 &amp;&amp; strpos( fgets( $fp, 2048 ), "statusResponse" ) ) {
        echo( 'Server alive' );
} else {
        echo( 'Server died' );
        system( "C:/gameservers/UrbanTerror/ForceRestart.bat &amp;&amp; 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 :D

_________________
Image



 


Top
 Profile  
 
PostPosted: 12.31.08 
Offline
Godlike
User avatar

Joined: 07.15.08
Posts: 4648
Location: Behind U
-----tdm:  
nick: [dswp]GewitterOma
skill: 1122.83
kills: 25960
deaths: 19847
ratio: 1.30
-----bomb:  
nick: [dswp]GewitterOma
skill: 812.172
kills: 3885
deaths: 3541
ratio: 1.09
oki heres new version of the thing. xtj7 built some test repeating in since some times rcon dont answer.

the script test several times before its going to restart serwer :)


Code:
<?php
$check_attempts = 5;
$check_ip = '192.168.9.1';
$check_port = 22222;
$check_timeout = 1;
$check_wait = 1;
$check_call = "START C:/gameservers/UrbanTerror/ForceRestart.bat &amp;&amp; exit";

// Code
$failed = true;
$attempts = $check_attempts;
while( $attempts > 0 ) {
        if( checkUrTServer( $check_ip, $check_port, $check_timeout ) ) {
                $attempts = 0;
                $failed = false;
        } else {
                sleep( $check_wait );
                $attempts --;
        }
}

// Actions to perform on success / fail
if( $failed == true ) {
        echo( 'Server died...' );
        system( $check_call, $output );
} else {
        echo( 'Server alive' );
}

// Functions
function checkUrTServer( $ip, $port = 22222, $timeout = 1 ) {
        $fp = fsockopen( 'udp://' . $ip, $port, $errno, $error, $timeout );  
        fwrite( $fp, "xFFxFFxFFxFFgetstatusx00" );
        if( $fp &amp;&amp; strpos( fgets( $fp, 2048 ), "statusResponse" ) ) {
                return( true );
        } else {
                return( false );
        }
}
?>

_________________
Image



 


Top
 Profile  
 
PostPosted: 01.01.09 
Offline
Kanzlerin
User avatar

Joined: 07.24.08
Posts: 1063
Location: Germany
-----tdm:  
nick: [dswp]xtj7
skill: 753.35
kills: 98
deaths: 95
ratio: 1.03
Aww, if I had known you wanted to publish it, I had made the code look pretty and not some ugly scribbling like that... :D Well, too late. It's only a simple and dirty solution for a problem that isn't supposed to exist in the first place.
So guys, if the server doesn't respond, visit the forum and it's supposed to restart.

_________________
Quote:
<XTJ7> !penis
<CuntBot> XTJ7, your penis is 23.3 cm long. 8=========D
<XTJ7> !8ball do i rock?
<CuntBot> XTJ7: OH YEAH !
<BEH> !8ball you lieing too?
<CuntBot> BEH: Totally not.
<BEH> -_-''



 


Top
 Profile  
 
PostPosted: 01.03.09 
Offline
Godlike
User avatar

Joined: 07.15.08
Posts: 4648
Location: Behind U
-----tdm:  
nick: [dswp]GewitterOma
skill: 1122.83
kills: 25960
deaths: 19847
ratio: 1.30
-----bomb:  
nick: [dswp]GewitterOma
skill: 812.172
kills: 3885
deaths: 3541
ratio: 1.09
its a problem that dont exist anylonger thx supi code :)

_________________
Image



 


Top
 Profile  
 
PostPosted: 01.10.09 
Offline
Godlike
User avatar

Joined: 07.15.08
Posts: 4648
Location: Behind U
-----tdm:  
nick: [dswp]GewitterOma
skill: 1122.83
kills: 25960
deaths: 19847
ratio: 1.30
-----bomb:  
nick: [dswp]GewitterOma
skill: 812.172
kills: 3885
deaths: 3541
ratio: 1.09
ah btw, for our "windows users"

:D :lol: :? :) ;) :( :shock:

if u have the same prob like me:
(the batch stops when starting the gameserver, it will just continue when the urt console window closes)

use hstart with /NOCONSOLE to start the iourtded.exe
very nice progi, it keeps the promise that bill gave with the "start" command

heres site:
http://www.ntwind.com/software/utilities/hstart.html

heres its capabilities:

Attachment:
hstart_help21.png
hstart_help21.png [ 31.69 KiB | Viewed 4112 times ]


it means that the gameserver will be restarted again and again and again, no matter how long im in holiday.

_________________
Image



 


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 43 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Imprint

Powered by phpBB © 2000, 2002, 2005, 2007, 2008, 2009, 2010 phpBB Group

Skin by Lucas Kane
we use apache2 mod rewrite with phpBB SEO
map train_beta1-100 © 2009 by SteveMcQueen
Statistics Backend + Database by XLR Stats and B3 Bot
mapvote robot and gameserver monitor © 2009 by BlinKy
mumble viewer Copyright © 2008 Dominik Radner (aka Urmel)
mumble switcher and integration © 2008 by XTJ7, Unclefragger and Wursti
Localisation Plugin © 2009, Team Leads Plugin © 2009 and Knifer Plugin © 2009 by SvaRoX
for our stats we use Chart.js Copyright (c) 2013-2015 Nick Downie.
the stats also use some jQuery jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc.



voice server
top 20 players


nameskillkills
-Dws.BLINGBLING*-*1730.63418631
NormaSnockers1865.75400492
Zottel1760.8276378
make.them.suffer1846.17269872
>8v=1825.35230156
moon1777.56195615
sjas1692.49192315
peace1878.86190660
Wagner_Moura1562.9188001
Goomba1859.75182677
z0rn1608.41181016
Mad1803.76179124
[dswp]PLZ1847.85178516
Graf_ZahlIII1835.73167407
Zohan1611.07159737
ubercunt1634.93159240
Yarrr!1917.33156233
I_am_nOOb1909.64151268
Pandageddon1891.75148319
Pirat1664.08145798