[NTLUG:Discuss] Weird Script behaviour -- killing script does not kill child processes - Why?
Wayne Walker
wwalker at bybent.com
Tue Dec 4 23:22:36 CST 2007
in your script, somewhere you call java, no matter how complicated the script is.
on the very next line do:
echo $! > /foo.manual.pid
Now you have a pid file you can trust.
As to why killing the parent script doesn't kill the child, that's a
long discussion about signal handlers. "man signal" once you read that,
if you still want to know more, email me on or off list.
On Tue, Dec 04, 2007 at 06:22:58PM -0600, Stephen Davidson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Greetings.
>
> I've been working on a piece of Server software and have been having fun
> and games with startproc.
>
> The general idea:
> Due to a fairly complex command line, I have a shell script that is
> actually launching the server process. The server process is a Java
> process running as a child of that shell script.
>
> The minor issue - even though the -p /file.pid is used, no pid file is
> getting created.
>
> The MAJOR issue - when the Shell script that launched the java process
> is killed, either by startproc or otherwise, the child Java Process is
> NOT killed.
>
> Any ideas on how to kill a child process of a command line script
> automatically, when there is no PID stored during startup?
>
> - -Steve
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2 (GNU/Linux)
> Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
>
> iD8DBQFHVe9iPtiPEDq7o8YRAhC6AKC7PXT5XxxCdurQrURktdunUisfMACggbQA
> qRjEC0Lc74SvVk0MlZErmeE=
> =xdS2
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
--
Wayne Walker
# Code comments are lies waiting to happen
wwalker at bybent.com Do you use Linux?!
http://www.bybent.com Get Counted! http://counter.li.org/
Perl - http://www.perl.org/ Perl User Groups - http://www.pm.org/
Jabber: wwalker at jabber.gnumber.com AIM: lwwalkerbybent
IRC: wwalker on freenode.net
More information about the Discuss
mailing list