SUMMARY: killing one's own shell

From: Christopher L. Barnard (cbar44@tsg.cbot.com)
Date: Wed Nov 03 1999 - 13:10:03 CST


I asked:

> We have a script in some monitoring software that should kill the shell
> that it is in when it finishes. Right now the last line is to do a
> "kill -9" on the parent ID of the shell script, but that generates an
> error in the monitoring software (it is tripped by the -9 flag to kill).
> A regular kill, an exit, a logout, having this script called by another
> script that does a regular kill or exit, have all been tried and do not
> work. Is there any other way to have a shell script kill the shell in
> which it is running?

The solution:

I received several suggestions, which I have forwarded on to the group that
has been having this problem. Despite my repeated requests to find out how
things went, the idea of a summary to a mailing list is just too foreign I
guess. So I'm sending out this summary with the suggestions, but I do not
have the information about whether on not these worked.

The recommendations that involved any sort of "kill" was rejected out of hand,
because my understanding is that these have all been tried and none of them
worked. I also got the recommendation to make sure the shell starts with the
shell name (of course) with the -f flag.

Most folks, however, recommended running the script like this "exec foo.sh"
instead of just "foo.sh". That is what I have recommended.

Thanks to:

web@merit.edu
agony <agony@adhesive.com>
Roger Fujii <rmf@lookhere.com>
Karl Baker <kbaker@matrox.com>
"A jannu" <achladi@hotmail.com>
"Neill, Mark" <Mark_Neill@csx.com>
Patrice ALLAIS <allais@lucent.com>
David Foster <foster@dim.ucsd.edu>
Peter Polasek <pete@cobra.brass.com>
"Brion Leary" <brion@dia.state.ma.us>
Jochen Bern <bern@penthesilea.uni-trier.de>
"S. Khemmanivanh" <somckit@u.washington.edu>
"Salehi, Michael E" <Mike.Salehi@usa.xerox.com>
"Martin Carpenter" <martincarpenter@hotmail.com>
Ian MacPhedran <Ian_MacPhedran@mackenzie.usask.ca>

+-----------------------------------------------------------------------+
| Christopher L. Barnard O When I was a boy I was told that |
| cbarnard@tsg.cbot.com / \ anybody could become president. |
| (312) 347-4901 O---O Now I'm beginning to believe it. |
| http://www.cs.uchicago.edu/~cbarnard --Clarence Darrow |
+----------PGP public key available via finger or PGP keyserver---------+



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:31 CDT