Re: java process check script (103 Views)
Reply
Super Advisor
rajesh73
Posts: 431
Registered: ‎03-17-2009
Message 1 of 3 (152 Views)

java process check script

i need to write the script when java process not shows, because my application running in java based.

 

so i need alert mail when java process failed

 

 

~]# ps -ef |grep java
Admin 17774     1  1 08:39 ?        00:12:48 /opt/apache-tomcat/
root     23073 23055  0 22:29 pts/2    00:00:00 grep java

 

 

if the admin process failed , i need alert mail

Please use plain text.
Honored Contributor
Steven Schweda
Posts: 9,079
Registered: ‎02-23-2005
Message 2 of 3 (112 Views)

Re: java process check script

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,881
Registered: ‎03-06-2006
Message 3 of 3 (103 Views)

Re: java process check script

>I need alert mail when java process failed

 

What is the name of the process?  What if there are many java processes?

UNIX95=EXTENDED_PS ps -f -C java 2> /dev/null | grep -q java

if [ $? -ne 0 ]; then

   echo "ps can't find any java processes" | mailx -s "No java process" mail-address

fi

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation