Raised This Month: $32 Target: $400
 8% 

Starting hlds with PID


Post New Thread Reply   
 
Thread Tools Display Modes
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 08-14-2015 , 02:38   Re: Starting hlds with PID
Reply With Quote #11

Quote:
Originally Posted by gloBi View Post
@aron9forever, yeah, but do you know how Monit works
I don't even know what it is, I just provided a reliable and easy way to get PID of running process
__________________
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
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 08-14-2015 , 05:54   Re: Starting hlds with PID
Reply With Quote #12

Check if the process is running and / or the port the gameserver is running on is opened (gameserver is online). That's what I did.
__________________
Kia is offline
gloBi
Member
Join Date: Dec 2008
Old 08-15-2015 , 05:24   Re: Starting hlds with PID
Reply With Quote #13

Quote:
Originally Posted by Kia View Post
Check if the process is running and / or the port the gameserver is running on is opened (gameserver is online). That's what I did.
Now I have 2 scripts - start.sh and stop.sh. The first one start the server, the second one stop the server. When the scripts are executed in terminal in linux, they work correctly.

/bin/sh /home/dido/user/stop.sh
/bin/sh /home/dido/user/start.sh

But in Monit, only the stop script when I press Stop Service works. The start script failed and the output in Monit is "Execution failed" as you can see in the log.

Execution of start.sh:

Code:
[EEST Aug 14 12:32:15] info     : 'gameserver' start on user request
[EEST Aug 14 12:32:15] info     : monit daemon at 25821 awakened
[EEST Aug 14 12:32:15] info     : Awakened by User defined signal 1
[EEST Aug 14 12:32:15] info     : 'gameserver' start: /bin/sh
[EEST Aug 14 12:32:18] error    : 'gameserver' failed to start
[EEST Aug 14 12:32:18] info     : 'gameserver' start action done
Execution of stop.sh:

Code:
[EEST Aug 14 12:53:14] info     : 'gameserver' stop on user request
[EEST Aug 14 12:53:14] info     : monit daemon at 25821 awakened
[EEST Aug 14 12:53:14] info     : Awakened by User defined signal 1
[EEST Aug 14 12:53:14] info     : 'gameserver' stop: /bin/sh
[EEST Aug 14 12:53:14] info     : 'gameserver' stop action done
Everything seems good in Monit:

Process Name = gameserver
Pid file = /home/dido/user/pid.pid
Monitoring mode = active
Start program = '/bin/sh /home/dido/user/start.sh' timeout 3 second(s)
Stop program = '/bin/sh /home/dido/user/stop.sh' timeout 3 second(s)
Existence = if does not exist 1 times within 1 cycle(s) then restart else if succeeded 1 times within 1 cycle(s) then alert
Pid = if changed 1 times within 1 cycle(s) then alert
Ppid = if changed 1 times within 1 cycle(s) then alert
CPU usage limit = if greater than 50.0% 2 times within 2 cycle(s) then restart else if succeeded 1 times within 1 cycle(s) then alert
System Name = system_debian
Monitoring mode = active

I should notice that if the start script is executed in terminal manual, the server works and Monit see server is running (so everything with the pidfile is correct).

Last edited by gloBi; 08-15-2015 at 05:29.
gloBi is offline
Send a message via Skype™ to gloBi
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 08-16-2015 , 04:33   Re: Starting hlds with PID
Reply With Quote #14

Make sure monit has permission to execute the script.
__________________
Kia is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 08-16-2015 , 06:23   Re: Starting hlds with PID
Reply With Quote #15

also make sure that when running hlds, you either have the script in the same folder as hlds_run or you cd there before it, hlds can't be linked with folders because it won't find it's files(so no ./home/user/hlds_run)
__________________
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
gloBi
Member
Join Date: Dec 2008
Old 08-30-2015 , 08:02   Re: Starting hlds with PID
Reply With Quote #16

Yes, i have changed the script and everything is working fine Thanks again.
gloBi is offline
Send a message via Skype™ to gloBi
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 20:34.


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