<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=gb2312"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"批注框文本 Char";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:9.0pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.Char
{mso-style-name:"批注框文本 Char";
mso-style-priority:99;
mso-style-link:批注框文本;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Hi<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>I want to write a shell script to monitor oned process to check if oned is running and healthy.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>my script only can count the number of process. and it can’t check if it is really healthy.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>could you please give me some ideas? thank you very much.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>$ ps -fu oneadmin<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>UID PID PPID C STIME TTY TIME CMD<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>oneadmin 5096 1 0 14:46 ? 00:00:46 /opt/nebula/ONE/bin/oned -f<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>oneadmin 5097 1 0 14:46 ? 00:00:11 /opt/nebula/ONE/bin/mm_sched<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>oneadmin 5120 5096 0 14:47 ? 00:01:12 ruby /opt/nebula/ONE/lib/mads/one_vmm_exec.rb -t 15 -r 0 kvm<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>oneadmin 5131 5096 0 14:47 ? 00:00:33 ruby /opt/nebula/ONE/lib/mads/one_im_exec.rb -r 0 -t 15 kvm<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>oneadmin 5141 5096 0 14:47 ? 00:00:24 ruby /opt/nebula/ONE/lib/mads/one_tm.rb tm_ssh/tm_ssh.conf<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>oneadmin 5155 5096 0 14:47 ? 00:00:18 ruby /opt/nebula/ONE/lib/mads/one_hm.rb<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>oneadmin 5166 5096 0 14:47 ? 00:00:18 ruby /opt/nebula/ONE/lib/mads/one_image.rb fs -t 15<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>oneadmin 5176 5096 0 14:47 ? 00:00:18 ruby /opt/nebula/ONE/lib/mads/one_auth_mad.rb --authn ssh,x509,ldap,server_cipher,server_x509<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>checkrun(){<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> _num=`ps -ef|grep 'ONE' |grep -v grep |wc -l`<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> if [ $_num -eq 8 ]; then<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> RETVAL=0<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> return $RETVAL<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> elif [ $_num -eq 0 ]; then<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> RETVAL=1<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> return $RETVAL<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> fi<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:9.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Best Regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:9.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Yang Yi</span><span lang=EN-US style='font-family:"Verdana","sans-serif"'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div><p>---------------------------------------------------------------------------------------------------<br>
Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) <br>
is intended only for the use of the intended recipient and may be confidential and/or privileged of <br>
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is <br>
not the intended recipient, unauthorized use, forwarding, printing, storing, disclosure or copying <br>
is strictly prohibited, and may be unlawful.If you have received this communication in error,please <br>
immediately notify the sender by return e-mail, and delete the original message and all copies from <br>
your system. Thank you. <br>
---------------------------------------------------------------------------------------------------</p></body></html>