onintr, trap, etc.

Mike O'Connor mjo at irie.ais.org
Wed Apr 3 12:08:15 AEST 1991


In article <15683 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:
: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.

Thanks for the information.  I will trap for "1".  






====
Mike O'Connor <mjo at ais.org>



More information about the Comp.unix.questions mailing list