cplane_pid=`pidof hnb_gw.exe`
if [ -z $cplane_pid ]
then
STATUS=`failure`
echo "Cplane hnbgw running $STATUS"
else
STATUS=`success`
echo "Cplane hnbgw running $STATUS"
fi
echo
Run Code Online (Sandbox Code Playgroud)
如果有多个实例hnb_gw.exe,pidof 将返回多个 pid。of-z预计[只有一个 pid。一种解决方案可能是使用-spidof 开关仅返回一个 pid。