automating daily monitoring process

Hi there,

I have to automate daily monitoring process and then the result of these process should be sent to a log file, then this log file should be  mailed .

ps -ef | grep aa

In this atleast one process should run.
If the process is running it should mention Success in the log file if not mention it as failure.

Please can anyone assit in this.

Thanks In Advance,
Neha.

process_status=`ps -ef | grep aa | grep -v grep`
if [ $? -eq "0" ]; then
echo "Success" > /tmp/logfile.log
mailx -s "Success - Process Running" abcd@abc.com < /tmp/logfile.log
else
echo "Failed" > /tmp/logfile.log
mailx -s "Failed - Process not Running" abcd@abc.com < /tmp/logfile.log
fi

Thanks!!

I want this mail to be sent daily morning.

Can u plz help in this.

Thanks in Advance,
Neha

Hey Neha,

set up a cron

read about the cron from the below link

Crontab � Quick Reference

thanks
kamaraj