onintr, trap, etc.

Doug Gwyn gwyn at smoke.brl.mil
Wed Apr 3 10:21:38 AEST 1991


In article <1991Apr1.201415.5305 at engin.umich.edu> mjo at 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.



More information about the Comp.unix.questions mailing list