Raised This Month: $120 Target: $400
 30% 

[Linux] HLDSWatch - hl/srcds monitoring and auto restarter script


Post New Thread Reply   
 
Thread Tools Display Modes
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 11-22-2014 , 08:11   Re: [Linux] HLDSWatch - hl/srcds monitoring and auto restarter script
Reply With Quote #21

umm what do i use for the ip?? the external ip or internal ip (127.0.0.1)?

Code:
eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet6 addr: xxxx::xxxx:xxx:xxxx:xxx/xx Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2613422596 errors:0 dropped:22 overruns:0 frame:0
          TX packets:2739288514 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:327326371622 (327.3 GB)  TX bytes:1245207172103 (1.2 TB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:225108 errors:0 dropped:0 overruns:0 frame:0
          TX packets:225108 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:27258977 (27.2 MB)  TX bytes:27258977 (27.2 MB)

ppp0      Link encap:Point-to-Point Protocol
          inet addr:xxx.xxx.xxx.x  P-t-P:168.95.98.254  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:2613356460 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2739223571 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:269827310398 (269.8 GB)  TX bytes:1184939847938 (1.1 TB)
----edit ----

seems like you need to use the external ip

Last edited by 8guawong; 11-22-2014 at 09:03.
8guawong is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 11-22-2014 , 09:36   Re: [Linux] HLDSWatch - hl/srcds monitoring and auto restarter script
Reply With Quote #22

11-22 20:47:06 -> Monitoring 4 servers
11-22 21:121 -> xxx.xxx.xxx.xxxxxx is down
11-22 21:13:00 -> * Attempt to restart failed

what happens then?? does the script keeps retry or??
cuz for my srcd start line it check for update as well so it takes a bit longer to start the server
so eventhough server started fine but hldswatcher still think its down (or failed to restart?)

---------------------------edit-------------------------------

after looking at the code it doesn't retry (i think ;-))
i think changing sleep (5) in def watch(self): will make it wait longer to check if restart is fine or not :-)

Last edited by 8guawong; 11-22-2014 at 18:53.
8guawong is offline
linuxvpsuser
Junior Member
Join Date: Jun 2015
Old 10-08-2015 , 11:11   Re: [Linux] HLDSWatch - hl/srcds monitoring and auto restarter script
Reply With Quote #23

Quote:
Originally Posted by 8guawong View Post
11-22 20:47:06 -> Monitoring 4 servers
11-22 21:121 -> xxx.xxx.xxx.xxxxxx is down
11-22 21:13:00 -> * Attempt to restart failed

what happens then?? does the script keeps retry or??
cuz for my srcd start line it check for update as well so it takes a bit longer to start the server
so eventhough server started fine but hldswatcher still think its down (or failed to restart?)

---------------------------edit-------------------------------

after looking at the code it doesn't retry (i think ;-))
i think changing sleep (5) in def watch(self): will make it wait longer to check if restart is fine or not :-)
http://sourceforge.net/p/hldstart/wi...ation%20Notes/

install this and you will be dont get this problem
__________________
google store app LINE

User ID
11111223334444

add me

Last edited by linuxvpsuser; 10-08-2015 at 11:19.
linuxvpsuser is offline
Send a message via Skype™ to linuxvpsuser
Hamartia
Member
Join Date: Oct 2015
Old 08-24-2016 , 15:15   Re: [Linux] HLDSWatch - hl/srcds monitoring and auto restarter script
Reply With Quote #24

Works like a charm. Thank you.
__________________
Hamartia is offline
DJEarthQuake
Senior Member
Join Date: Jan 2014
Location: Midwest
Old 12-04-2018 , 19:54   Re: [Linux] HLDSWatch - hl/srcds monitoring and auto restarter script
Reply With Quote #25

Quote:
Originally Posted by Mlk27 View Post
Correct but the restart routine in the hlds_run script would only work if hlds exits its process on crash, which unfortunatelty isn't always the case on mod servers because more often that not, these servers just go stalled and don't exit their server process when they crash
Make sure logging is on modded server with:
Code:
log on
What this does is waits for file size to be zero. The last 30 or so minutes of the server's history log is found and saved. Once it is 0 we know the server is hung and needs to be killed so the server restart process can resume. I use a much simpler nmap the port approach for that matter. If port 27015 is closed the hlds or srcds process (your server) begins again no matter what with optional page/e-mail options.

I had a ball using PHP beforehand since there is no such thing as a UDP ping tester. PHP made me regret not learning it 20 years ago. I had a PHP script checking UDP latency. If over spec amount of so many thousand from momentary map change, it retested again to make sure it was just a map change. PHP was the only book not on my shelf. Scary what it can sniff on a single UDP packet. Paul's Home Page. Thanks Paul. Long forgotten author of PHP.


This is my busy or lazy admin script developed 5 years ago. Finding the bad plugin, which is almost always 3rd party bots, is the best method. IE| cs and cz. CZ has bots native. CS does not.

Quote:
#exec ~/retry.sh
was added and removed in this example I am sharing to eliminate false positives. Then there is a separate process killer if port is not open I used with nmap every min or however you want. HLDSWatch in your case. There is nothing like being in a perfectly good game then, JANK, your own game, from your own script. Keep the cron times long so this does not happen.

Code:
cat sizer.sh


#!/bin/bash
sleep 7
myfilesize=`stat -c %s ~/log_GTM.log`
if [ $myfilesize = 0 ]
then
#exec ~/retry.sh
else
echo "The file size is NOT zero it's" $myfilesize 
fi
exit 0



cat logger.sh


#!/bin/bash
MOD="gearbox"
find ~/Steam/steamapps/common/Half-Life/$MOD/logs/* -mmin -30 >~/log_GTM.log && cat log_GTM.log && ls -la log_GTM.log
I changed this as I pasted and initially grabbed the wrong script. This 2 different files. Name as you wish .sh. chmod +x thefile.sh of course. Enjoy no longer being exasperated.

There is a much noticeable load difference not having to run and maintain server with PHP to use the latency script which would also work but cost 5% or more on the core. That is literally money as it uses more electricity.

So cstrike users replace gearbox with cstrike and so on for other mods. Make the logger every minute to 7. The sizer @hourly. Anything less than 40 minutes without running a second script to do a double-check it will lead to disappointments

Oh to the fellow with the IP problem. inet addr: xxx.xxx.xxx.x P-t-P:168.95.98.254. I think you already know 168 is your PPPoE peer, as you put x on yours, mate.

Quote:
whois 168.95.98.254 |grep Country
Country: AU
This funny thing is, this wasn't even the post I was seeking, still haven't found it, found 1 similar and posted. Now I post here!

Best of luck everybody keeping the servers running well.
__________________
"It's not the actual programming that's interesting. But it's what you can accomplish with the end results that are important." -Dennis Ritchie
"Mathematics, rightly viewed, possesses not only truth, but supreme beauty a beauty cold and austere, like that of sculpture..." -Bertrand Russell
DJEarthQuake is offline
Reply


Thread Tools
Display Modes

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 12:43.


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