mjo@irie.ais.org (Mike O'Connor) (04/02/91)
I am trying to write a script that will only run when I receive a hangup signal (i.e. when I am forcibly disconnected). How do I determine that I am indeed HUPped? So far, I have: #!/bin/sh #deathtrap -- will run these commands if I get HUPped trap hangupscript 0 When I run this interactively with: % nohup deathtrap & The script wants to run immediately. What am I doing wrong? What I really want to do is have my .logout run from tcsh in the event that I am lorcibly logged out. Currently, it only runs if I type "logout". HELP! ____ Mike O'Connor <mjo@ais.org>
gwyn@smoke.brl.mil (Doug Gwyn) (04/03/91)
In article <1991Apr1.201415.5305@engin.umich.edu> mjo@ais.org writes:
-I am trying to write a script that will only run when I receive a
-hangup signal (i.e. when I am forcibly disconnected).
-#!/bin/sh
-#deathtrap -- will run these commands if I get HUPped
-trap hangupscript 0
-When I run this interactively with:
-% nohup deathtrap &
-The script wants to run immediately.
Of course it does -- trap #0 means upon EOF, which occurs at the
end of the "deathtrap" shell script. Try trap #1, and make sure
the "deathtrap" script doesn't terminate except upon the trap.
mjo@irie.ais.org (Mike O'Connor) (04/03/91)
In article <15683@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes: :In article <1991Apr1.201415.5305@engin.umich.edu> mjo@ais.org writes: :-I am trying to write a script that will only run when I receive a :-hangup signal (i.e. when I am forcibly disconnected). :-#!/bin/sh :-#deathtrap -- will run these commands if I get HUPped :-trap hangupscript 0 :-When I run this interactively with: :-% nohup deathtrap & :-The script wants to run immediately. : :Of course it does -- trap #0 means upon EOF, which occurs at the :end of the "deathtrap" shell script. Try trap #1, and make sure :the "deathtrap" script doesn't terminate except upon the trap. Thanks for the information. I will trap for "1". ==== Mike O'Connor <mjo@ais.org>