Any more updates on this? Would it be possible to intergrate the nemrun updating into the php script?
> Date: Fri, 22 Jul 2011 14:18:05 -0400 > From: [email protected] > To: [email protected] > Subject: Re: [hlds_linux] PHP auto reload crashed server. > > Keep updated.. I'll finish a better version today that checks if the server > exited without proper shutdown possibly with a SM plugin. if it can't rcon > into the server it will check a file the SM plugin updates or possibly a DB > entry that keeps track of the server being live. When it restarts the server > it will wait until it gets the "Server is up" message before continuing the > process of checking if rcon doesn't work. > > I'll think of something.. > > On Fri, Jul 22, 2011 at 11:44 AM, daniel jokiaho > <[email protected]>wrote: > > > Hmm if i run this script togheter with nemrun. > > Can i somehow disable this script when nemrun finds an update. > > > > # These are defaults set later by command line options, see --help > > # Command to send shared screens > > SHAREDKILLCOMMAND="quit" > > # Script to run when an update is found > > NOTIFYCMD="*disable abowe script*" > > # Script to run after updates complete > > AFTERNOTIFYCMD="*reenable abowe script*" > > > > Im think its possibe but what how is my question. Then it would be safe to > > use this script and still get autoupdates. > > > > > > > > > > > > > > > > > > > > > > On 22 July 2011 14:36, Eric Riemers <[email protected]> wrote: > > > > > Only thing it does is try and kill srcds when its auto-updating, which > > > makes no sense but it wont go tits up either. If you let it kill a screen > > > then it will also kill your auto-update. Be aware of that ;) > > > > > > On Fri, 22 Jul 2011 08:22:50 -0400, Chris <[email protected]> wrote: > > > > Wont this do a endless loop of killing/starting the server if the > > server > > > is > > > > down because valve can possibly put out a patch this evening? > > > > > > > > I'm just trying to get my servers to auto-start as i'm going to be out > > of > > > > town all weekend and need some automated/fail proof setup for the > > servers > > > > crashing. > > > > > > > > > > > > > > > > On Fri, Jul 22, 2011 at 7:27 AM, E3pO <[email protected]> wrote: > > > > > > > >> You can change the killall srcds_linux to something like... > > > >> > > > >> kill `ps aux | awk '/srcds_new_surf/{print $2}'` > > > >> > > > >> > > > >> > > > >> > > > > > > > > http://www.linuxquestions.org/questions/linux-software-2/how-do-i-kill-a-screen-from-command-line-if-i-know-the-screen-name-357064/#post1822639 > > > >> > > > >> > > > >> On Fri, Jul 22, 2011 at 6:43 AM, daniel jokiaho > > > <[email protected] > > > >> >wrote: > > > >> > > > >> > how to edit this so i just kill screen x ? > > > >> > On 22 Jul 2011 00:27, "E3pO" <[email protected]> wrote: > > > >> > > I made the script to check and reload server. I didn't make the > > rcon > > > >> > code. > > > >> > > On Jul 21, 2011 2:12 PM, "Björn Rohlén" <[email protected]> > > > >> wrote: > > > >> > >> That looks a lot like FiDos code. You sure you MADE IT? > > > >> > >> > > > >> > >> -The G > > > >> > >> > > > >> > >> On Thu, Jul 21, 2011 at 9:43 PM, E3pO <[email protected]> wrote: > > > >> > >> > > > >> > >>> After the recent update and the server crashing non stop I made > > a > > > >> > little > > > >> > >>> php > > > >> > >>> script so I could go to sleep.... > > > >> > >>> > > > >> > >>> <?php > > > >> > >>> > > > >> > >>> define('PACKET_SIZE', '1400'); > > > >> > >>> define('SERVERQUERY_INFO', "\xFF\xFF\xFF\xFFTSource Engine > > > Query"); > > > >> > >>> define ('REPLY_INFO', "\x49"); > > > >> > >>> define('SERVERQUERY_GETCHALLENGE', "\xFF\xFF\xFF\xFF\x57"); > > > >> > >>> define ('REPLY_GETCHALLENGE', "\x41"); > > > >> > >>> define('SERVERDATA_AUTH', 3) ; > > > >> > >>> define ('SERVERDATA_EXECCOMMAND', 2) ; > > > >> > >>> > > > >> > >>> class srcds_rcon > > > >> > >>> { > > > >> > >>> > > > >> > >>> private function getByte(&$string) > > > >> > >>> { > > > >> > >>> $data = substr($string, 0, 1); > > > >> > >>> $string = substr($string, 1); > > > >> > >>> $data = unpack('Cvalue', $data); > > > >> > >>> return $data['value']; > > > >> > >>> } > > > >> > >>> > > > >> > >>> private function getShortUnsigned(&$string) > > > >> > >>> { > > > >> > >>> $data = substr($string, 0, 2); > > > >> > >>> $string = substr($string, 2); > > > >> > >>> $data = unpack('nvalue', $data); > > > >> > >>> return $data['value']; > > > >> > >>> } > > > >> > >>> > > > >> > >>> private function getShortSigned(&$string) > > > >> > >>> { > > > >> > >>> $data = substr($string, 0, 2); > > > >> > >>> $string = substr($string, 2); > > > >> > >>> $data = unpack('svalue', $data); > > > >> > >>> return $data['value']; > > > >> > >>> } > > > >> > >>> > > > >> > >>> private function getLong(&$string) > > > >> > >>> { > > > >> > >>> $data = substr($string, 0, 4); > > > >> > >>> $string = substr($string, 4); > > > >> > >>> $data = unpack('Vvalue', $data); > > > >> > >>> return $data['value']; > > > >> > >>> } > > > >> > >>> > > > >> > >>> private function getFloat(&$string) > > > >> > >>> { > > > >> > >>> $data = substr($string, 0, 4); > > > >> > >>> $string = substr($string, 4); > > > >> > >>> $array = unpack("fvalue", $data); > > > >> > >>> return $array['value']; > > > >> > >>> } > > > >> > >>> > > > >> > >>> private function getString(&$string) > > > >> > >>> { > > > >> > >>> $data = ""; > > > >> > >>> $byte = substr($string, 0, 1); > > > >> > >>> $string = substr($string, 1); > > > >> > >>> while (ord($byte) != "0") > > > >> > >>> { > > > >> > >>> $data .= $byte; > > > >> > >>> $byte = substr($string, 0, 1); > > > >> > >>> $string = substr($string, 1); > > > >> > >>> } > > > >> > >>> return $data; > > > >> > >>> } > > > >> > >>> > > > >> > >>> public function rcon_command($ip, $port, $password, $command) > > > >> > >>> { > > > >> > >>> $requestId = 1; > > > >> > >>> $s2 = ''; > > > >> > >>> $socket = @fsockopen ('tcp://'.$ip, $port, $errno, $errstr, 30); > > > >> > >>> if (!$socket) > > > >> > >>> return('Unable to connect!'); > > > >> > >>> $data = pack("VV", $requestId, > > > >> > >>> SERVERDATA_AUTH).$password.chr(0).$s2.chr(0); > > > >> > >>> $data = pack("V",strlen($data)).$data; > > > >> > >>> fwrite ($socket, $data, strlen($data)); > > > >> > >>> > > > >> > >>> $requestId++ ; > > > >> > >>> $junk = fread ($socket, PACKET_SIZE); > > > >> > >>> $string = fread ($socket, PACKET_SIZE); > > > >> > >>> $size = $this->getLong($string); > > > >> > >>> $id = $this->getLong($string) ; > > > >> > >>> > > > >> > >>> if ($id == -1) > > > >> > >>> { > > > >> > >>> return 'Authentication Failed!'; > > > >> > >>> } > > > >> > >>> > > > >> > >>> $data = pack ("VV", $requestId, > > > >> > >>> SERVERDATA_EXECCOMMAND).$command.chr(0).$s2.chr(0) ; > > > >> > >>> $data = pack ("V", strlen ($data)).$data ; > > > >> > >>> fwrite ($socket, $data, strlen($data)) ; > > > >> > >>> $requestId++ ; > > > >> > >>> $i = 0 ; > > > >> > >>> $text = '' ; > > > >> > >>> > > > >> > >>> while ($string = fread($socket, 4)) > > > >> > >>> { > > > >> > >>> $info[$i]['size'] = $this->getLong($string) ; > > > >> > >>> $string = fread($socket, $info[$i]['size']) ; > > > >> > >>> $info[$i]['id'] = $this->getLong ($string) ; > > > >> > >>> $info[$i]['type'] = $this->getLong ($string) ; > > > >> > >>> $info[$i]['s1'] = $this->getString ($string) ; > > > >> > >>> $info[$i]['s2'] = $this->getString ($string) ; > > > >> > >>> $text .= $info[$i]['s1']; > > > >> > >>> $i++ ; > > > >> > >>> return $text; > > > >> > >>> } > > > >> > >>> } > > > >> > >>> } > > > >> > >>> while (true) > > > >> > >>> { > > > >> > >>> echo '---- Server Check ----'.PHP_EOL; > > > >> > >>> $srcds_rcon = new srcds_rcon (); > > > >> > >>> $result = > > > >> > >>> $srcds_rcon->rcon_command ("SERVERIP", "27015", "RCONPASSWORD", > > > >> > >>> "status"); > > > >> > >>> if ($result == "Unable to connect!") > > > >> > >>> { > > > >> > >>> echo 'ERROR: Can not connect to the server!'.PHP_EOL; > > > >> > >>> $today = date ("F j, Y, g:i a"); > > > >> > >>> > > > >> > >>> passthru ('killall srcds_linux'); > > > >> > >>> echo 'Killed all srcds_linux'.PHP_EOL; > > > >> > >>> passthru ('ulimit -c 2097152 && > > > >> > >>> /home/srcds/srcds_new_surf/orangebox/srcds_run -debug -console > > > >> > >>> -game > > > >> tf > > > >> > > +ip > > > >> > >>> 65.18.168.205 +port 27015 +map surf_supersurf_v2 +maxplayers 32 > > > >> > >>> -autoupdate'); //fu** you autoupdate breakn my shit > > > >> > >>> echo 'Reloaded server.'.PHP_EOL; > > > >> > >>> $message = "Surf Server Crashed (again fml) ".$today; > > > >> > >>> mail ('[email protected],[email protected]', 'Surf > > > Crashed', > > > >> > >>> $message); > > > >> > >>> } > > > >> > >>> else > > > >> > >>> { > > > >> > >>> echo escapeshellarg ($result).PHP_EOL; > > > >> > >>> } > > > >> > >>> echo '---- Waiting 60 Seconds ----'.PHP_EOL; > > > >> > >>> sleep (60); > > > >> > >>> } > > > >> > >>> > > > >> > >>> ?> > > > >> > >>> > > > >> > >>> Some may find it usefull... run as php5 script.php. > > > >> > >>> _______________________________________________ > > > >> > >>> To unsubscribe, edit your list preferences, or view the list > > > >> archives, > > > >> > >>> please visit: > > > >> > >>> http://list.valvesoftware.com/mailman/listinfo/hlds_linux > > > >> > >>> > > > >> > >> _______________________________________________ > > > >> > >> To unsubscribe, edit your list preferences, or view the list > > > >> > >> archives, > > > >> > > please visit: > > > >> > >> http://list.valvesoftware.com/mailman/listinfo/hlds_linux > > > >> > > _______________________________________________ > > > >> > > To unsubscribe, edit your list preferences, or view the list > > > >> > > archives, > > > >> > please visit: > > > >> > > http://list.valvesoftware.com/mailman/listinfo/hlds_linux > > > >> > _______________________________________________ > > > >> > To unsubscribe, edit your list preferences, or view the list > > archives, > > > >> > please visit: > > > >> > http://list.valvesoftware.com/mailman/listinfo/hlds_linux > > > >> > > > > >> _______________________________________________ > > > >> To unsubscribe, edit your list preferences, or view the list archives, > > > >> please visit: > > > >> http://list.valvesoftware.com/mailman/listinfo/hlds_linux > > > >> > > > > _______________________________________________ > > > > To unsubscribe, edit your list preferences, or view the list archives, > > > > please visit: > > > > http://list.valvesoftware.com/mailman/listinfo/hlds_linux > > > > > > _______________________________________________ > > > To unsubscribe, edit your list preferences, or view the list archives, > > > please visit: > > > http://list.valvesoftware.com/mailman/listinfo/hlds_linux > > > > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the list archives, > > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlds_linux > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlds_linux _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlds_linux

