Re: a unix script to send email notification when a sas batch job fails?
- From: William Park <opengeometry@xxxxxxxx>
- Date: Fri, 17 Mar 2006 19:02:19 -0500
Jerry <greenmt@xxxxxxxxx> wrote:
Hi,
This post may be a bit off topic, but essentially it's mainly about
unix script, not SAS (a statistical software). (but I posted it on
comp.soft-sys.sas too hoping for any clue)
My OS is RedHat Enterprise. When I want to run a sas code (say
freq.sas) in background on our server, I simply need to type in command
line "sas freq.sas &".
SAS documentation says that:
"an Exit Status Code can be used to determine the Completion Status of
a SAS Job in UNIX Environments."
and
"The exit status for the completion of a SAS job is returned in $status
for the C shell, and in $? for the Bourne and Korn shells. A value of 0
indicates normal termination."
So I'm wondering if this information could be used to write a short
simple unix script which is able to do the following 2 things:
1, invoke a sas job in batch mode
2, send me an email if this sas batch job fails
Say the name of this unix script is "AutoNotify", and the sas code I
want to run is "freq.sas".
And I hope this script can function this way:
when I type "./AutoNotify freq.sas", it will
1, run freq.sas in background,
2, and will send me an email if the Exit Status Code is not
zero.
Any input is welcome, an sample of such script would be greatly
appreciated. (not a homework question, I just know very little about
unix scripting)
Thank you very much in advance !!!
Solution:
sas freq.sas || mail -s "SAS job failed" your@address < /dev/null
Wait... I gave away solution for free... doh!
--
William Park <opengeometry@xxxxxxxx>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/
.
- References:
- Prev by Date: Re: Strange Socket problem
- Next by Date: Re: Seekable in-memory file?
- Previous by thread: Re: a unix script to send email notification when a sas batch job fails?
- Next by thread: Re: a unix script to send email notification when a sas batch job fails?
- Index(es):
Relevant Pages
|