From: Andy Cohen <acohen () cognex ! com>
To: tru64-unix-managers
Subject: k shell help
Date: Wed, 28 Feb 2001 18:03:54 +0000 [thread overview]
Message-ID: <98338526128706.tru64-unix-managers.marc@archive.invalid> (raw)
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@cognex.com <
/home/psoft75/fs750/appserv/PSCHED_I
S_RUNNING.MSG
else
mailx -v -s ${PSCHED_ID}_psched_is_not_running acohen@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
reply other threads:[~2001-02-28 18:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox