This is a discussion on Killing of a process and send a mail if the process doesnot come up within 2 minutes within the Shell scripting forums, part of the Development/Scripting category; Hi Friends, I have a problem here and i need someone to solve this. Let us consider there are two ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
Hi Friends,
I have a problem here and i need someone to solve this. Let us consider there are two processes(abc & def).There is a script which kills these two processes(i.e killtheprocess abc). Here abc is the argument . There is a automated system which detects which process is killed and it starts the process up within two minutes.This is the summary. Now what i want is:- The program should contain these features:_ 1. It will take the PID of the two process. 2. kill the process with the help of the script(killtheproces . The script should contain the two process names(i.e abc & def) . 3. After the process is killed, it should be able to detect if the two particular process has come up within two minutes by the help of the automated sytem 4. If the process comes up then it will send a mail to a group of people that everything is fine . 5. if the process doesnot come up then it should send a mail to a group of people that it needs to be manually started. 6. For confirmation that the process has indeed gone down and come up the two PIDs should be different. It is urgent . Please help me out. If soemone needs some more clarification then please reply. Thanks |
| Sponsored Links | ||
|
|
|
|||
|
Code:
#get process names proc1=$(ps hc -o cmd -p $1) proc2=$(ps hc -o cmd -p $2) #kill 'em kill $1 $2 #sleep for 2 mins sleep 120 #check if they're running ( pgrep $proc1 && pgrep $proc2 ) > /dev/null $? && mail -s "All OK" $users || mail -s "Needs manual restart" $users |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| process need more memory | brijesh | Linux software | 3 | 12-13-2007 05:38 PM |
| httpd process | vimalgoel | Getting started tutorials | 1 | 10-08-2007 12:40 AM |
| Interacting with a Linux Process through Scripts | manikandakumar | Shell scripting | 1 | 08-17-2007 06:49 PM |
| how to enumerate currently running process | hiimsa | Coding in General | 2 | 11-11-2006 03:02 PM |
| Linux krefilld process and what is it doing on my system? | sweta | Linux software | 1 | 08-31-2006 01:16 AM |