Sponsored Content
Top Forums Programming How to implement SIGKILL and SIGTERM and print a message? Post 302144561 by porter on Thursday 8th of November 2007 06:18:52 PM
Old 11-08-2007
1. You can't catch SIGKILL by design.

2. You should be able to catch SIGTERM -

Have you unblocked it?
You are calling exit in your signal handler
Have you considered using atexit()

In general two things leap out...

1. you should do the absolute bare minimum in a signal handler, set a flag or a few things, not fflush() or anything the allocates/frees from the heap.

2. use the posix signal handling APIs, sigaction, sigprocmask etc.
 

10 More Discussions You Might Find Interesting

1. Programming

signals - SIGTERM

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. Shell Programming and Scripting

Why SIGKILL will occur?

Hi Gurus, I am executing my Datastage jobs on UNIX operating System. While running the jobs i am getting the following error: main_program: Unexpected termination by Unix signal 9(SIGKILL) Can any one please let me know what are the possible situations where this SIGKILL will arrise? ... (9 Replies)
Discussion started by: choppas
9 Replies

3. Solaris

To print Coloured Prelogin Message on SOLARIS--9................

Hiiii..... Every one...... I am using /etc/issue file to display Pre-login Message on my system, installed with SOLARIS-9. I am getting this Message in White fonts having Black background ( Colour of the Screen)..... So, is there ... (2 Replies)
Discussion started by: prashantshukla
2 Replies

4. Shell Programming and Scripting

Error while trying to print message

Hi all Geting this error while trying to print message as : ./logfunc: print: bad file unit number heres what i m trying to do : log_date="$(date '+%d/%m/%Y %H:%M:%S')" log_type="Message" print "${log_date}: ${log_type}" print -u3 "${log_date}: ${log_type}" this error is due to... (3 Replies)
Discussion started by: Navatha
3 Replies

5. Shell Programming and Scripting

Print a message at specific line on prompt

Hi Friends, I am using HP-UNIX(ksh). I want to print a message at specific line on the prompt screen. For Example: for num in 1 10 3 145 do echo $num // need to print this on the same line for each number sleep 2 done Actual Output: ========== 1 10 3 145 Expected Output:... (5 Replies)
Discussion started by: Niroj
5 Replies

6. Solaris

SIGQUIT and SIGKILL message

Dear All, I have machine with SunOS 5.10 Generic_138888-01 sun4v sparc SUNW,SPARC-Enterprise-T5120. Yesterday there is something at dmesg command : May 25 18:09:02 cacao_launcher: Timeout occured on heartbeat channel, cleanup engaged May 25 18:09:07 cacao_launcher: watchdog : warning,... (0 Replies)
Discussion started by: mbah_jiman
0 Replies

7. Shell Programming and Scripting

How to detect SIGTERM,SIGKILL signal in UNIX

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

8. Shell Programming and Scripting

SIGSTOP and SIGKILL

Which is sent to a terminal when it closes? SIGKILL? Reason I ask is I have a script I want to run in the background, but want it to run even if the terminal window is closed. Or, I'd like it to background itself if the terminal is closed but not if its running in an open window. I will learn how... (5 Replies)
Discussion started by: DC Slick
5 Replies

9. UNIX for Advanced & Expert Users

Print message while using sqlplus

I want to connect to oracle database from solaris... After that i will drop and create a no.of tables.One of the table example is as below. sqlplus -s usrname/password@dbname << SQL >> $logfile 2>&1 echo " dropping the table1" | tee logfile DROP TABLE Table1 echo "creating the table1" |... (1 Reply)
Discussion started by: millan
1 Replies

10. Shell Programming and Scripting

Script to check the string in a file and print an attribute in the message

Hi, I am new to shell scripting and got a task to complete. Task is : we have a log file where in i need to traverse through the whole file to check the string "Person Type missing in message" and after that i need to get EMPLID=xxxxxx from the file and print details in a different file. ... (1 Reply)
Discussion started by: suren424
1 Replies
SIGSET(3)						   BSD Library Functions Manual 						 SIGSET(3)

NAME
sigset -- manipulate signal dispositions LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <signal.h> void (* sigset(int sig, void (*disp)(int)))(int); DESCRIPTION
This interface is made obsolete by sigaction(2) and sigprocmask(2). The sigset() function manipulates the disposition of the signal sig. The new disposition is given in disp. If disp is one of SIG_DFL, SIG_IGN, or the address of a handler function, the disposition of sig is changed accordingly, and sig is removed from the process' signal mask. Also, if disp is the address of a handler function, sig will be added to the process' signal mask during exe- cution of the handler. If disp is equal to SIG_HOLD, sig is added to the calling process' signal mask and the disposition of sig remains unchanged. RETURN VALUES
If successful, the sigset() function returns SIG_HOLD if sig had been blocked, and the previous disposition of sig if it had not been blocked. Otherwise SIG_ERR is returned and errno is set to indicate the error. ERRORS
The sigset() function will fail if: [EINVAL] The argument sig is not a valid signal number; or an attempt is made to ignore a signal that cannot be ignored, such as SIGKILL or SIGSTOP. SEE ALSO
sigaction(2), sigprocmask(2) STANDARDS
The sigset() function conforms to IEEE Std 1003.1-2001 (``POSIX.1''). It was however marked as obsolete in the IEEE Std 1003.1-2008 (``POSIX.1'') revision of the standard. BSD
April 30, 2010 BSD
All times are GMT -4. The time now is 10:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy