Operating System - HP-UX
1833914 Members
2087 Online
110063 Solutions
New Discussion

Re: trap interrupts for 11.31?

 
Manuel Contreras
Regular Advisor

trap interrupts for 11.31?

the following entry worked for a captured user environment on 11.11, but not 11.31:

trap 'exit' 0 1 2 3 13 14 15 24


I checked the default /etc/profile on both boxes...both have the same entries:

# grep trap /etc/profile
trap "" 1 2 3
trap "echo logout" 0
trap 1 2 3


anyone encounter a fix for this?
thanks,
manuel
2 REPLIES 2
Dennis Handly
Acclaimed Contributor

Re: trap interrupts for 11.31?

What are you asking? What do you mean by "not work"? If you need those extra signals, you need to modify your own ~/.profile.
Bill Hassell
Honored Contributor

Re: trap interrupts for 11.31?

> # grep trap /etc/profile
> trap "" 1 2 3
> trap "echo logout" 0
> trap 1 2 3

trap in association with /etc/profile probably means you are referring to shell behavior. What shell are you running? What fix are you looking for?

OK, here's what /etc/profile is doing:

trap "" 1 2 3
which means: do nothing (ignore) signals 1,2 and 3 (SIGHUP, SIGINT, SIGQUIT respectively) from now on, that is, until the trap settings are changed. /etc/profile will run even if the connection is broken (in the old days, the modem would hang up -- HUP) as an example.

trap "echo logout" 0

When this script exits normally (signal 0), print the word: logout

trap 1 2 3
Return to the default action for signals 1, 2, and 3. So if a kill -3 is seen by /etc/profile, the shell will core dump.

=========================

trap 'exit' 0 1 2 3 13 14 15 24
In this shell script, all the signals (aka, kill options) 0,1,2,3,13,14,15,24 with simply exit. After this trap is run, kill -3 will no longer core dump the shell.

"...not 11.31..."
What does "not" mean? Do you get an error? a core dump? a kernel panic? smoke pouring out of the keyboard?


Bill Hassell, sysadmin