[mohaa] mohaa and pid's

Jim Mayes eoeleven at motion.net
Tue Aug 26 12:13:52 EDT 2003


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/2cc02e5c/attachment.htm>


More information about the Mohaa mailing list