Hi
I was going through one of my pjct script .Please let me know the logic for the deamon is running or not as i think the condtn should be vice-versa.
daemon_list = 'idp1278'
FAIL=0
for p in ${daemon_list}
do
fail=0
ps -fu workarea | grep ${p} > /dev/null 2>&1
if [[ $? -ne 0 ]] then
fail=1
msg="${p} daemon is down"
print -n "${p} is down"
else
msg="${p} daemon is up"
print -n "${p} is up"
fi
**where workarea is the hostname .
idp1278 i sthe daemon name .
when the process is running ,it is showing as below command :
ps -fu workarea | grep ${p} ->where $p is dp1278
workarea 28907 5374 1 02:41:54 pts/14 0:00 grep idp1278 workarea 6058 1 0 00:05:21 ? 0:00 ptr_DmnEnvelope idp1278L idp1278daemon_Sh.
My doubt i s:
1>when ? is coming the process is running actually but in the script it is wriiten if [? is !0 ]then daemon not running .. .what is the actual logic to check the daemon running .
2>ps -fu workarea | grep ${p}/dev/null 2>&1
where $p is idp1278 .
when i executedthe above script nothing came and it took me to next command prompt.At this time the idp12278 daem,on was running in my env .
Also please let me know why this command is used /dev/null 2>&1