Newsgroups: comp.unix.questions Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!irie.ais.org!mjo From: mjo@irie.ais.org (Mike O'Connor) Subject: Re: onintr, trap, etc. Message-ID: <1991Apr3.020815.20758@engin.umich.edu> Sender: news@engin.umich.edu (CAEN Netnews) Reply-To: mjo@ais.org Organization: Artificial Intelligence Society References: <1991Apr1.201415.5305@engin.umich.edu> <15683@smoke.brl.mil> Date: Wed, 3 Apr 1991 02:08:15 GMT 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