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

Starting hlds with PID


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gloBi
Member
Join Date: Dec 2008
Old 08-11-2015 , 05:59   Starting hlds with PID
Reply With Quote #1

Hello, everybody!

I want to know how to start my server with predefined PID? I tried with -pidfile pid.pid, where in pid.pid there is the predefined PID, but it doesn't work.

pid.pid file is located in the same directory as hlds and the starting script.

Any suggestions how to make it?

Thanks in advance.

Last edited by gloBi; 08-11-2015 at 06:02.
gloBi is offline
Send a message via Skype™ to gloBi
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 08-11-2015 , 08:45   Re: Starting hlds with PID
Reply With Quote #2

please explain why you need this
it's a very bad practice to do this, pids are supposed to be random

just tell what you need it for, I'm pretty sure it can be made in another way
__________________
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-11-2015 , 09:56   Re: Starting hlds with PID
Reply With Quote #3

I want to use Monit to monitor my servers. So if one server has crashed with 100% cpu usage, monit will restart it, but Monit works with PID.
gloBi is offline
Send a message via Skype™ to gloBi
MetalMessiah
Junior Member
Join Date: Aug 2012
Location: Odessa
Old 08-11-2015 , 10:55   Re: Starting hlds with PID
Reply With Quote #4

I think PID is a system process identificator, you can't submit your own.
Everything you can do is to start a process andget it's PID for monitoring.

P.S. I've never seen server crashed due to 100% CPU. You'll get FPS around 4.00 but not crash
__________________
Software, web sites, other development. PM.
MetalMessiah is offline
gloBi
Member
Join Date: Dec 2008
Old 08-12-2015 , 07:44   Re: Starting hlds with PID
Reply With Quote #5

So you have never seen anything

Some buggy plugin crashes the server and it starts using 100% cpu.

So, I still think there is a way to set pid, should be, so anyone help?
gloBi is offline
Send a message via Skype™ to gloBi
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-12-2015 , 09:25   Re: Starting hlds with PID
Reply With Quote #6

The only thing that you can do is start the server and get the PID that was given to it by the operating system. There's no reason to want to do it any other way.
__________________
fysiks is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 08-12-2015 , 11:51   Re: Starting hlds with PID
Reply With Quote #7

I use Monit too and everything is working fine using -pidfile
__________________
Kia is offline
gloBi
Member
Join Date: Dec 2008
Old 08-13-2015 , 07:51   Re: Starting hlds with PID
Reply With Quote #8

Quote:
Originally Posted by Kia View Post
I use Monit too and everything is working fine using -pidfile
So, where is my mistake? I'm starting the server like that:

./hlds_run -game cstrike +ip -port -pidfile pid.pid +rcon_password ....

and file pid.pid is located where starting script is located. I tried also to give full path, but same.

@fysiks
If there is a way monit to get the PID of started server, OK, tell me how to make it.



EDIT: Aha, I tried with --pidfile /full/path and it works

EDIT 2: Now I understand, it is not predefined PID, --pidfile option just writes the pid of the started server in a file, so everytime when i start the server, the PID is different. And Monit read that pid file and knows which process is the server

Now i should think about start/stop/restart script, any ideas here ?

Last edited by gloBi; 08-13-2015 at 08:42.
gloBi is offline
Send a message via Skype™ to gloBi
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 08-13-2015 , 13:28   Re: Starting hlds with PID
Reply With Quote #9

Quote:
Originally Posted by gloBi View Post
So, where is my mistake? I'm starting the server like that:

./hlds_run -game cstrike +ip -port -pidfile pid.pid +rcon_password ....

and file pid.pid is located where starting script is located. I tried also to give full path, but same.

@fysiks
If there is a way monit to get the PID of started server, OK, tell me how to make it.



EDIT: Aha, I tried with --pidfile /full/path and it works

EDIT 2: Now I understand, it is not predefined PID, --pidfile option just writes the pid of the started server in a file, so everytime when i start the server, the PID is different. And Monit read that pid file and knows which process is the server

Now i should think about start/stop/restart script, any ideas here ?
if you know full path to binary, there's "pidof" to use
example
PHP Code:
pidof /home/user3/server100/cs/hlds_i686 
will return process PID if it's launched so no needs for pid files
__________________
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-13-2015 , 18:12   Re: Starting hlds with PID
Reply With Quote #10

@aron9forever, yeah, but do you know how Monit works
gloBi is offline
Send a message via Skype™ to gloBi
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 08:03.


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