Date: Mon, 10 Dec 2007 19:47:32 +1300
Reply-To: Robin Templer <templerr@CLEAR.NET.NZ>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Robin Templer <templerr@CLEAR.NET.NZ>
Subject: Re: Can SAS send text messages to cell phones?
In-Reply-To: <200712100354.lB9BqLYX021081@mailgw.cc.uga.edu>
Content-type: text/plain; charset=us-ascii
A very large caveat to doing this - reinforcing David concerns.
Do not use SAS to do this - in a batch process which has failed, SAS will
not get to send the email message. You could use a separate SAS step to
check the return code of the previous SAS invocation, but I think this is
using a sledgehammer to crack a nut.
We check the return code from the sas job run in a shell script, and if the
return code is not 0 or 1, then send of lots of sms alerts.
Some sample code follows: (Note that the script uses a lot of user
functions, and smsalert is another script which ends up with calling mailx
to send the alerts) .
# Invoke SAS and do the matching. This should take approx 2 hours ******
#
#
echo "$PROCESS Process Starting at $THEDATE..........." >> $JOBLOG
$SAS_CMD -sysin ${COMMDIR}/${PROGNAME}.sas \
-log ${LOGFILE}.log \
-print ${LOGFILE}.lst
sasexit=$?
export END_DATE=`date +%Y%m%d:%H:%M:%S`
# test the SAS exit rc
case ${sasexit} in
0)
echo "$PROCESS Process Ending $RUN_DATE.............." >>
$JOBLOG
log_trailer
exit 0
;;
1)
echo "$PROCESS Process Ending $RUN_DATE.............."
>> $JOBLOG
echo "$PROCESS process ended with WARNINGS
$RUN_DATE.............." >> $JOBLOG
echo "### Check for messages in: $LOGFILE"
>> $JOBLOG
log_trailer
exit 0
;;
*)
echo
"################################################################" >>
$JOBLOG
echo "### $PROCESS process ABORTED $RUN_DATE.............." >>
$JOBLOG
echo "### $PROCESS process ABORTED $RUN_DATE.............." >>
$JOBLOG
echo "### Check for messages in: $LOGFILE"
>> $JOBLOG
echo
"################################################################" >>
$JOBLOG
echo >> $JOBLOG
log_trailer
${ENV}smsalert "$REPLICA" "$REPLICA $PROGNAME Aborted" \
"See Log File: $LOGFILE"
exit 999
esac
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of David
Johnson
Sent: Monday, 10 December 2007 4:55 p.m.
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Can SAS send text messages to cell phones?
In the UK and Australia there are web based services to lodge and send SMS
messages. Most have an alternative textual interface. There are
restrictions to prevent spamming of course, and many cost money.
In Australia where fewer such services are available, one of a number of
companies is called SMSPUP which allows you to subscribe your mobile
telephone and then buy or earn credits for sending messages to your
mobile. So I have monitoring processes that can send an email to <my
mobile>@smspup.com and the message subject will appear as a text message on
my mobile.
There are multitudinous services in the States, I had terrible difficulties
finding a local service because of all the geographically irrelevant
responses I got to a web search when I was trying to find a suitable
service here.
Two cautions: the telephone companies don't guarantee delivery times or
even completions on SMS messages, so diversifying providers and sending
mission critical messages to multiple destinations is a good idea.
Secondly, if step 15 in a program develops an error, and step 90 sends the
email, be aware that the error may set Obs to 0 and the email data step
will be compiled but not executed. You need to work around that issue.
Kind regards
David