PDA

View Full Version : server pid


tgscereal_killer
08-19-2003, 01:40 AM
i know this is more for linux help rather than mohaa server but is there any way to assign a pid to multiple mohaa servers under linux?

FredG
08-19-2003, 03:05 PM
yeah... I asked something like this awhile back and never got any responce. So I would still be interested in hearing some comments on the subject if anybody has any.

greensha
08-22-2003, 08:48 AM
Pretty sure it could be done. Im not a linux genuis but you could probably use a script in combination with the screen command

Only an example
screen

./yourscript.sh
which contains ie
./mohaa_lnxded +set dedicated 1 +set net_ip 1.1.1.1 +set dedicated 1 +exec server.cfg&

./mohaa_lnxded +set dedicated 1 +set net_ip 1.1.1.2 +set dedicated 1 +exec server.cfg&

./mohaa_lnxded +set dedicated 1 +set net_ip 1.1.1.3 +set dedicated 1 +exec server.cfg&

by using the & at the end of the command line it backgrounds the process and goes on to the next command in the script

then when disconnect from the screen via ctrl+A+D you have a pid assigned to the screen that is running in the background. now all the mohaa servers will have there own pid's but so does the screen utililty. kill the pid of the screen command and everything running on that screen is killed. This is theory only not really sure if it would work.

I will post over at icculus.org mohaa mailing list (moh linux binary developer ) alot of those guys no there linux stuff.. I will get back with a better answer than that imaginary theory i just came up with.

greensha
08-22-2003, 09:38 AM
It was just pointed out to me to use the killall command.

killall -9 mohaa_lnxded

not sure if you will need to add * to the end of that for the various command line differences in ip's

killall -9 mohaa_lnxded*

try it out let me know.

FredG
08-22-2003, 10:29 AM
Sure that works... but the problem is, it kills all running instances of mohaa_lnxded. The significant value of being able to obtain a pid for each instance of mohaa_lnxded running is that it would allow you to kill just one of your servers (for people who run more than one).

Thanks for your comments on this, you gave me some ideas about things I had over looked (I'm definitely still an amateur shell scripter). I'll check out that mohaa linux list too, didn't even know that was out there. But basically here's the concept in a little more detail:

We need a modified version of the stay alive script that when executed starts mohaa_lnxded with your config in a screen and somehow writes the pid of it's self and the screen it created to separate files. File one (pid of the stay alive process) would be named something like "serverNameHere_kill.pid" and file 2 (pid of the screen moh is running in) would be "serverNameHere_restart.pid". These files would contain just the pid for their respective processes. Then you could code a script (to automate things) that you passed "serverNameHere" to, and if you wanted to kill or restart. That script would then "kill cat serverNameHere_restart.pid" to read in the contents of the correct file (and subsequently the correct pid) perform the correct action on the correct server instance. To restart the server you would only have to kill the pid of the screen, because the stay-alive script would see the screen die and restart it. Boy that all sure would be nifty ;)

Anyway I've worked a bit on a stay alive script that is a little more multiple-server friendly, but I just don't have the knowledge to script the other parts needed to get this all working.

greensha
08-22-2003, 06:07 PM
Well way above my head your best would be to subscribe to the icculus.org mohaa mailing pose the question in there and Im pretty sure someone would be able to help you.

to subscribe to the list
send a blank email to

mohaa-subscribe@icculus.org

to view the list
http://icculus.org/cgi-bin/ezmlm/ezmlm-cgi?23:ddp:0:0#b