Hi
i wrote script use it as watchdog ( i mean it check another program (pooya) whenever that was killed (closed or crashed) it run another script (pooya_start.sh) to start it,
this script work fine and do the job for me , i need help of an expert to tell me (exact command) how to change this script use Minimum resource ( Cpu & memory) to work?
while sleep 1
do
if ps x | grep -v grep | grep -c pooya >/dev/null
then
echo ""
else
echo `date` "R" >> /tmp/Check_pooya.log
/var/bin/pooya_start.sh start &
fi
done
exit 0
1,( line 3) : i was read in other forum don't grep grep : how could change this to other way ( please wrote exact command for me)
2.( line 5) : is there any better command instead of echo "" use no memory and do nothing ( just wrote this line to do nothing if pooya is run)
pgrep command is unknown in sh4
any other way please?
or any fix on my code to use minimum resource? (ie is that echo "" the best way ( use min resource) to do nothing