11-09-2007
1. Both sigaction and signal install signal handlers,
(a) don't use both in the same program,
(b) sigaction is the posix one, use that.
(c) With sigaction you don't need to reinstall the signal handler.
2. atexit installs another callback function, so when the program exits politely, through a call to exit you code will get called so you can tidy up.
3. only set flags in the signal handlers, don't do 'work'.
4. you have done sigfillset but done nothing with the sigset_t, you need to call sigprocmask to block or unblock those signals.
5. to ignore a signal, you can
(a) either use SIG_IGN as the callback
(b) or simply block it so it is never delivered to your program.
(c) or get it to call an empty signal handler function
6. compile with maximum warnings, if you are using gcc use "-Wall -Werror", that would have caught your "atexit".
7. And as mentioned, you can't catch SIGKILL, the kernel will just evaporate your process.
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. Shell Programming and Scripting
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
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
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
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
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
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
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
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
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
LEARN ABOUT DEBIAN
qpsmtpd-prefork
qpsmtpd-prefork(8) System Manager's Manual qpsmtpd-prefork(8)
NAME
qpsmtpd-prefork - Preforkin server for qpsmtpd
SYNOPSIS
qpsmtpd-prefork [options]
DESCRIPTION
qpsmtpd-prefork is the qpsmtpd frontend script which binds to the SMTP TCP socket, and asynchronously forks new children in advance of new
connections.
OPTIONS
--port port
Binds to a specific port, instead of the default 2525.
--user user
On startup, switch to run as user instead of the starting user. Applies only when started as root (as is normal when listening on
port 25).
--limit-connections limit
Accept at most limit simultaneous connections. Inbound connections beyondthis limit will be deferred or refused.
--max-from-ip limit
Accept at most limit simultaneous connections from any given IP address; does not override --limit-connections, if set.
--children limit
Limit the total number of child processes to limit; once all children are handling requests, further connections are deferred.
--idle-children count
Keep count child processes available, subject to the upper bound given via --children. Specify 0 to disable preforking entirely.
--interface addr
Bind to the local address addr, instead of the default behavior of binding to all interfaces. Can be specified multiple times to
bind to more than one interface or local address.
--renice-parent delta
Adjust the priority of the parent process by delta, yielding more CPU time to other processes. The default is 5.
--detach
Detach from the controlling terminal at startup, to run as a standalone daemon. See also --pid-file.
--pid-file filename
Upon startup, and after daemonizing if applicable, write the process ID to filename, for use by sysvinit control scripts or similar
utilities.
--pretty-child
Update child process names within the process table.
--version
Print the qpsmtpd release version and exit.
--debug
Be somewhat more verbose about logging during startup (has no effect once fully started).
--help Display commandline help and exit.
AUTHOR
Copyright (c) 2006, SoftScan; based on qpsmtpd-forkserver by Ask Bjorn Hansen <ask@develooper.com>
http://smtpd.develooper.com/
qpsmtpd-prefork(8)