tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* k shell help
@ 2001-02-28 18:03 Andy Cohen
  0 siblings, 0 replies; only message in thread
From: Andy Cohen @ 2001-02-28 18:03 UTC (permalink / raw)
  To: tru64-unix-managers

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-02-28 18:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-02-28 18:03 k shell help Andy Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox