Hi,
I have a need to check to see if a process is running and if its not then
send e-mail.
I've written a script that accomplishes this by redirecting the output from
a 'ps -elf|grep -i proc_name|grep -v grep' and if the resulting file has a
zero size then sends e-mail.
sample:
export PSCHED_ID=prod75;
echo Checking for the $PSCHED_ID Process Scheduler ...
date
ps -elf|grep -i PSRUN$PSCHED_ID|grep -v grep > psched_stat_$PSCHED_ID.txt
if [[ -s psched_stat_$PSCHED_ID.txt ]]
then
mailx -v -s ${PSCHED_ID}_psched_is_running acohen_at_cognex.com <
/home/psoft75/fs750/appserv/PSCHED_I
S_RUNNING.MSG
else
mailx -v -s ${PSCHED_ID}_psched_is_not_running acohen_at_cognex.com <
/home/psoft75/fs750/appserv/PSCH
ED_IS_NOT_RUNNING.MSG
fi
What I'd rather do is check for the process and based on the results send an
e-mail without getting this intermediary file involved.
What I'm looking to do then is something like this:
if [[ ps -elf|grep -i PSRUN$PSCHED_ID|grep -v grep ]]
but I can't get this syntax to work.
I imagine this is possible but how?
Any ideas?
Thanks,
Andy
Andy Cohen
Database Systems Administrator
Cognex Corporation
1 Vision Drive
Natick, MA 01760-2059
voice: 508/650-3079
pager: 877-654-0447
cell: 508/294-0863
fax: 508/650-3337
Andy Cohen
Database Systems Administrator
Cognex Corporation
1 Vision Drive
Natick, MA 01760-2059
voice: 508/650-3079
pager: 877-654-0447
cell: 508/294-0863
fax: 508/650-3337
Received on Wed Feb 28 2001 - 18:35:02 NZDT