Raised This Month: $51 Target: $400
 12% 

How to detect if server crashed?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
danonix
Senior Member
Join Date: Dec 2012
Old 02-06-2015 , 04:50   How to detect if server crashed?
Reply With Quote #1

@topic
danonix is offline
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 02-06-2015 , 05:32   Re: How to detect if server crashed?
Reply With Quote #2

Ping it.
If it isn't responding - server is down.
__________________
simanovich is offline
danonix
Senior Member
Join Date: Dec 2012
Old 02-06-2015 , 07:14   Re: How to detect if server crashed?
Reply With Quote #3

I mean that, so if it possible to make just it in a moment, when server crashes and then generate log - server crashed at 2:01 pm, actual map was X.

Don't want to check logs in folder with console logs

Last edited by danonix; 02-06-2015 at 07:35.
danonix is offline
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 02-06-2015 , 08:24   Re: How to detect if server crashed?
Reply With Quote #4

Try FM_ServerDeactivate or plugin_end() !
Freezo Begin is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-06-2015 , 18:26   Re: How to detect if server crashed?
Reply With Quote #5

When the server crashes you can't do anything because no code is running. You have to have something do that on the operating system.

Simply look in the logs for the time that it crashed and look upward to find the last map that started.
__________________
fysiks is online now
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-06-2015 , 18:37   Re: How to detect if server crashed?
Reply With Quote #6

If you use a service that automatically re-starts a crashed server (HLSW?) you can write a flag somewhere as you initiate a mapchange then delete the flag when the mapchange successfully completes. If this flag does not exist when the server is starting, then the last shutdown was not graceful. Just an idea.

1. map change initiated, write flag
2. map change complete, check if flag exists
  • if exists delete it, everything went well
  • if does not exist, previous shutdown was ungraceful
__________________
Bugsy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-07-2015 , 01:12   Re: How to detect if server crashed?
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
HLSW?
HLSW uses RCON and public methods to get it's info afaik. I can't get to the operating system which is required to restart the server (unless it's set up to restart itself already of course).
__________________
fysiks is online now
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-07-2015 , 09:13   Re: How to detect if server crashed?
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
HLSW uses RCON and public methods to get it's info afaik. I can't get to the operating system which is required to restart the server (unless it's set up to restart itself already of course).
I used to run a hlds on my LAN and used HLSW, but I don't remember if it was for this purpose, its been years. But, I imagine server hosts restart your server if it crashes for whatever reason?
__________________

Last edited by Bugsy; 02-07-2015 at 09:51.
Bugsy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-07-2015 , 12:28   Re: How to detect if server crashed?
Reply With Quote #9

Quote:
Originally Posted by Bugsy View Post
I used to run a hlds on my LAN and used HLSW, but I don't remember if it was for this purpose, its been years. But, I imagine server hosts restart your server if it crashes for whatever reason?
I'm not really sure how they typically do it. That's not something that is made known at the few GSPs that I've had servers with (I never really asked either).
__________________
fysiks is online now
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 02-10-2015 , 07:36   Re: How to detect if server crashed?
Reply With Quote #10

as far as I know servers auto restart when debug=""
that stops working if the process is killed(which means something went horribly wrong)

to be somewhat helpful to the OP, you can not do this with amxx
even bugsy's idea won't work because it won't give you the exact time of the crash and hosting providers usually fail to restart the server if the process is kill, then you won't get the accurate timestamp

What you want is very possible and easy to accomplish with PHP and a cron job if you have some knowledge in that area
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode