[mohaa] mohaa and pid's

Josh Berry josh at chickenmonkey.co.uk
Tue Aug 26 13:31:08 EDT 2003


There is a solution to this (its worth a try anyway). The -g flag on
killall closes all associated processes so .
 
You start two servers like so:
 
Screen -S mohaa -m -d ./stay_alive_1.sh
Screen -S mohaa -m -d ./stay_alive_2.sh
 
You should then be able to kill the first server, for example, using:
 
Killall -g stay_alive_1.sh
 
This should kill the stayalive process, the screen process and the sleep
process I assume that you have running. Not 100% it will work in this
situation but give it a go.
 
Josh
 
-----Original Message-----
From: Jim Mayes [mailto:eoeleven at motion.net] 
Sent: 26 August 2003 17:14
To: mohaa at icculus.org
Subject: Re: [mohaa] mohaa and pid's
 
Thanks guys, that info helped me a lot with my problem too. I've got
just one more pid problem that I wondering if someone could maybe shed
some light on. Much like Josh's situation I have a screened "stay alive"
function. So when I kill the server's pid, the stay alive restarts it.
Now, I have a loader script that I use to launch this "stay alive"
script in a detached screen like so:
 
screen -S mohaa -m -d ./stay_alive.sh
 
What I need is a way to get the pid of that screen, because if I have a
pid for it I can stop the stay alive process too so the server doesn't
automatically restart (giving me start/stop/restart functionality!!). So
I tried the same idea and added the command to echo the pid into a file
when the screen is started like:
 
screen -S mohaa -m -d ./stay_alive.sh & echo $! > stayalive.pid
 
but the pid that gets written into the file is always 1 lower than the
actually pid for the screen?? Is there some trick to getting the pid of
a screen? I could just cat stayalive.pid, add 1 to it and then kill, but
I would much rather be working with the actual pid for the screen. Any
ideas?
 
Jim
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/mohaa/attachments/20030826/44f2d186/attachment.htm>


More information about the Mohaa mailing list