![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to trap unix signal if the process killed/interupt occured in bash... | manas_ranjan | Shell Programming and Scripting | 15 | 09-23-2007 09:47 AM |
| Unix command help required | thaduka | UNIX for Dummies Questions & Answers | 7 | 10-17-2005 04:24 PM |
| Sending a signal from Unix to Windows | robbiegregg | UNIX for Dummies Questions & Answers | 3 | 04-07-2005 11:46 AM |
| sigwait system call in UNIX signal | md7ahuja | High Level Programming | 1 | 04-26-2004 06:17 AM |
| UNIX PATH info required PLEASE HELP (I'm new to unix) | akitachi | UNIX for Dummies Questions & Answers | 1 | 05-10-2002 03:37 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Help required regarding Unix Signal
It is required to trap the signal send to a daemon process before rebooting a unix server. Suppose a script abc.ksh is running in the server as daemon. Before rebooting the server, the unix admin kills all the daemon processes. It is not known to me how admin kills the processes; I mean by which kill option (e.g. -9). And if it is killed by -9 option, what will be the trap signal in the script. I tried with 1, 2, 9, 15. But it is not working.
Thanks in advance. |
|
||||
|
What you are describing is SUPPOSED to happen.
If it is imperative that the abc.ksh daemon do something special before exiting, then you will have to have the sysadmin run a special script for shutdown, one that calls your abc.ksh, then waits 1 - 2 seconds then shutesdown the system. Otherwise why are you worried about it? |
|
||||
|
The constraint is I can not ask sysadmin to do something special for my daemon script abc.ksh. Let me tell you in detail. The abc.ksh is a monitoring script which checks whether database is up and running. It sleeps for 10 mins and wakes up to do these tests and again sleeps. If database is not running then it sends mail to related persons to look into the matter.
During last weekend the unix server is rebooted without my knowledge. Yesterday only I discovered the daemon is not running. So, I need to have a trap in my script which will recognize it is being killed. And subsequently it will send a mail to me informing me that the daemon is not running. I am facing problem with the trap signal. I have given 1, 2, 3, 6, 9, 15, 18, 20, 32 and tested with control C. The script gets killed and sends me a mail. But when I am testing it with kill -9, no mail is being sent. I want to know -- 1. Which option sysadmin use when he/she kills unix daemons before rebooting? 2. What will be trap signal if it is being killed by kill -9 option. |
|
||||
|
As said before, you cannot trap SIGKILL or SIGSTOP by anyway,
I can suggest a different idea, since the main problem is if the server gets rebooted without notification there is no way to identify that the daemon has to be specifically rebooted. Instead have your daemon in rc scripts when server goes to a reboot from shutdown automatically daemon also will start running. Hope this helps! ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|