Advertisement

05.15.2008 at 12:10AM PDT, ID: 23404173
[x]
Attachment Details

How to create a bash script to check whether a process is dead or not ?

Asked by smksa in Linux Programming, Linux

Tags:

Hi,

I would like to request an assistant.

Anybody know how to create a bash script to detect whether a process is ALIVE or DEAD ?

The process that i want to detect is as follows (using ps aux) :

root     30303  0.4  1.0 189828 21400 ?      SNl  Apr30  97:45 /usr/local/jdk1.6.0_02/bin/java com.fpx.seller.daemon.PluginDaemon

I have developed a simple scripts as attached to detect whether the above process dead but it seems not working.

Appreciaates if anybody can help or find the best way to do it .

Thank you,

Regards,
Sham

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
#!/bin/bash
 
LOAD=`ps aux | grep fpx | wc -l`
 
if [ $LOAD = 1 ]
then
 echo 'ALERT - FPX Is not Running at MAIN SERVER
 
PLEASE CHECK NOW !!
 
Date :'`date` | mail -s "ALERT: FPX PLUGIN NOT RUNNING" email@domain.com
exit 1
fi
[+][-]05.15.2008 at 12:23AM PDT, ID: 21571255

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 12:26AM PDT, ID: 21571271

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.15.2008 at 12:35AM PDT, ID: 21571312

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 12:37AM PDT, ID: 21571317

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 12:46AM PDT, ID: 21571347

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 01:10AM PDT, ID: 21571449

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 01:22AM PDT, ID: 21571500

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 09:42AM PDT, ID: 21575620

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 10:27AM PDT, ID: 21576132

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.15.2008 at 10:39AM PDT, ID: 21576256

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 11:13AM PDT, ID: 21576574

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 01:16PM PDT, ID: 21577575

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Linux Programming, Linux
Tags: bash, linux
Sign Up Now!
Solution Provided By: Tintin
Participating Experts: 4
Solution Grade: B
 
 
[+][-]05.15.2008 at 06:31PM PDT, ID: 21579210

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628