06-08-2017
Quote:
Originally Posted by
Mrucker
K.. I found the issue. 'Twas a trap "" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Now. Can anyone explain to me.. WHY someone would do this? Is there any logical purpose to it?
I take it, the question was not (only) rhethorical, yes?
First, why one would try to intercept a non-maskable interrupt like -9 is beyond me - most probably a case of "have not understood the concept of non-maskable". The other signals - well, if you want to trap these (that is - want your program not to do anything whe these signals are received), then this is what you do. I have done similar things on occasion when i wanted a script not to be stoppable by a CTRL-C. Still, i think the occasions where this is desirable are quite limited and in most cases this is a pretty bad idea .
So - there, if this commiserating helps you any.
bakunin
Last edited by rbatte1; 06-09-2017 at 07:57 AM..
Reason: Retro added ICODE tags edit into quoted post
10 More Discussions You Might Find Interesting
1. Programming
Hi all,
I need some urgent help.
we are using Dynix/ptx V4.5 on i386, have several processes and instances are running on the box round the clock.we increased the processes recently.
We have coded to handle the signals in our programs.
Recently, we noticed most of our processes are... (2 Replies)
Discussion started by: reddyb
2 Replies
2. HP-UX
Hello,
Nice forum BTW... anyway on to my question.
I am trying to write a korn shell script that will shut down a java VM. The first challenge was how to figure out which java VM to kill, as there can be other java processes running at the same time.
Then I discovered fuser. It says it... (4 Replies)
Discussion started by: adamides
4 Replies
3. Programming
Hello,
I am running a webserver that uses sockets, forks, and children. The parent process listens for connections and the child processes the information.
I am trying to figure out why the code I have below SIGTERM, and SIGKILL never fire. I was messing around with the printfs and doesnt... (11 Replies)
Discussion started by: norelco55
11 Replies
4. Programming
the parent is a process manager in our design, and httpd service is one of its child processes, which is started in foreground mode (with "-D FOREGROUND" options) according to our requirements.
when httpd service is started, one main httpd process and eight sub httpd processes can be found by... (4 Replies)
Discussion started by: aaronwong
4 Replies
5. Shell Programming and Scripting
Dear All
We have JBOSS server running on Linux we need to track Graceful Shutdown(SIGTERM) and Forceful Shutdown(SIGKILL) timestamp and write it into one file, I am new to UNIX Signal processing if is it possible how to detect it?
We generally do
$kill PID For Graceful... (5 Replies)
Discussion started by: mnmonu
5 Replies
6. Programming
I' m note very expert in the reliable manage of signal... but in my server I must manage SIGPIPE for the socket and SIGTERM...
I've wrote this but there is something wrong... Can someone explain me with some example the reliable management of signal??
This is what I've wrote in the server
... (2 Replies)
Discussion started by: italian_boy
2 Replies
7. AIX
Hi Guys,
I tried running the firefox in AIX 6.1 and got the below error..
-bash-3.00# firefox
Could not load program /usr/mozilla/firefox/firefox-bin:
Could not load module /usr/mozilla/firefox/libxul.so.
Dependent module /usr/lib/libgtk-x11-2.0.a(libgtk-x11-2.0.so.0) could not... (0 Replies)
Discussion started by: kkeng808
0 Replies
8. Shell Programming and Scripting
Hello.
Could anyone tell me how can I configure a instance of Shell to ignore the SIGTERM signal? I would really appreciate.
Thanks. (6 Replies)
Discussion started by: razolo13
6 Replies
9. Shell Programming and Scripting
My ksh version is ksh93-
=>rpm -qa | grep ksh
ksh-20100621-3.fc13.i686
I have a simple script which is as below - #cat test_sigterm.sh -
#!/bin/ksh
trap 'echo "removing"' QUIT
while read line
do
sleep 20
done
I am Executing the script From Terminal 1 - 1. The ksh is started... (3 Replies)
Discussion started by: rpoornar
3 Replies
10. AIX
Hello, AIX 7.1 - several NetApp disks already running. Trying to install a new one. Storage folks provision it. I run cfgmgr - nothing. no new disks show up in "lsdev", "sanlun lun show" shows no new device. No errors, just nothing. Storage guys disconnect it and attaches to another aix server -... (5 Replies)
Discussion started by: sid
5 Replies
trap(1) User Commands trap(1)
NAME
trap, onintr - shell built-in functions to respond to (hardware) signals
SYNOPSIS
sh
trap [ argument n [n2...]]
csh
onintr [-| label]
ksh
*trap [ arg sig [ sig2...]]
DESCRIPTION
sh
The trap command argument is to be read and executed when the shell receives numeric or symbolic signal(s) (n). (Note: argument is scanned
once when the trap is set and once when the trap is taken.) Trap commands are executed in order of signal number or corresponding symbolic
names. Any attempt to set a trap on a signal that was ignored on entry to the current shell is ineffective. An attempt to trap on signal 11
(memory fault) produces an error. If argument is absent all trap(s) n are reset to their original values. If argument is the null string
this signal is ignored by the shell and by the commands it invokes. If n is 0 the command argument is executed on exit from the shell. The
trap command with no arguments prints a list of commands associated with each signal number.
csh
onintr controls the action of the shell on interrupts. With no arguments, onintr restores the default action of the shell on interrupts.
(The shell terminates shell scripts and returns to the terminal command input level). With the - argument, the shell ignores all inter-
rupts. With a label argument, the shell executes a goto label when an interrupt is received or a child process terminates because it was
interrupted.
ksh
trap uses arg as a command to be read and executed when the shell receives signal(s) sig. (Note that arg is scanned once when the trap is
set and once when the trap is taken.) Each sig can be given as a number or as the name of the signal. trap commands are executed in order
of signal number. Any attempt to set a trap on a signal that was ignored on entry to the current shell is ineffective. If arg is omitted
or is -, then the trap(s) for each sig are reset to their original values. If arg is the null (the empty string, e.g., "" ) string then
this signal is ignored by the shell and by the commands it invokes. If sig is ERR then arg will be executed whenever a command has a non-
zero exit status. If sig is DEBUG then arg will be executed after each command. If sig is 0 or EXIT for a trap set outside any function
then the command arg is executed on exit from the shell. The trap command with no arguments prints a list of commands associated with each
signal number.
On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways:
1. Variable assignment lists preceding the command remain in effect when the command completes.
2. I/O redirections are processed after variable assignments.
3. Errors cause a script that contains them to abort.
4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari-
able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not
performed.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
csh(1), exit(1), ksh(1), sh(1), attributes(5)
SunOS 5.10 23 Oct 1994 trap(1)