[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Email from SQR3 was [Re: Process Monitor run status]
- Subject: Re: Email from SQR3 was [Re: Process Monitor run status]
- From: Anne-Marie Matula <amatula@OIT.UMASS.EDU>
- Date: Tue, 1 Feb 2000 09:46:56 -0500
- Importance: Normal
- In-Reply-To: <200002010701.AAA20927@list.iex.net>
I just learned with lots and lots of sweat and stress and help (wonder how
many pounds I lost with that one ;). I have a call system using within my
SQR that calls a UNIX shell script. Here's both. Hope it helps:
If $sqr-platform = 'UNIX' and &Dbname = 'HEPRODA'
MOVE '/data/zzz/applicant/' to $um_dir
MOVE 'appl_email.sh' to $um_shell_script
DO Um-Email-Files($um_shell_script,$um_dir)
Else
SHOW 'NO EMAILS SENT'
SHOW '*************** Must execute on server in order to send email
************'
SHOW {BLANK}
End-If
! ============= Email Files =============================
begin-procedure Um-Email-Files($um_shell_script,$um_dir)
! Only executed if running on server
! called UNIX shell script
! that emails the 2 logs
! renames the logs using a bkp extension (so they will not be resent)
! If the file message is null that simply means the process hasn't run
! Don't send emails in testing environment
! If you need to test, just modify the shell script to send to yourself &
comment out dbase check
LET #status = 0
Let $command_String = $um_dir||$um_shell_script
CALL SYSTEM USING $command_String #status
If #Status <> 0
SHOW '******* PROCESS ABORTED *********** '
SHOW 'Status code is: ' #Status EDIT 999
SHOW {BLANK}
DO Um-Sql-Error
SHOW {BLANK}
End-If
end-procedure
----------------------------------------------------
Shell script (with some obvious changes to email addresses, etc):
towhom='xxx@rrre.ddd ssssd@rrrrr.ffff'
fromwhom='me@here.com'
datestamp=`date +"%D"`
echo "From: $fromwhom" > /data/zzz/applicant/out.tmp;
echo "To: $towhom" >> /data/zzz/applicant/out.tmp;
echo "Subject: Web Applicant Process $datestamp" >>
/data/zzz/applicant/out.tmp;
cat /u/data/www/applicant/umapplod.log /data/zzz/applicant/umaplpst.log
/data/zzz/applicant/umaplsch.log >> /data/zzz/applicant/out.tmp;
echo "\n.\n" >> /data/zzz/applicant/out.tmp;
cat /data/zzz/applicant/out.tmp | mail $towhom;
rm /data/zzz/applicant/out.tmp;
# backup the files so they can't get resent
mv -f /data/zzz/applicant/umapplod.log /data/zzz/applicant/umapplod.bkp;
mv -f /data/zzz/applicant/umaplpst.log /data/zzz/applicant/umaplpst.bkp;
mv -f /data/zzz/applicant/umaplsch.log /data/zzz/applicant/umaplsch.bkp;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Anne-Marie Matula
Student Information System Project
Office of Information Technologies
Whitmore Bldg, University of Massachusetts, Amherst
Phone: 413/577-0685
Fax: 413/545-2150
>
> Date: Mon, 31 Jan 2000 14:38:13 -0500
> From: Hrair Tcholakian <htcholakian@MBHCONSULTING.COM>
> Subject: Email from SQR3 was [Re: Process Monitor run status]
>
> OK!
>
> How does one email from within an SQR?
> Env: SQRW v3, Exchange/Outlook
> Thanks,
> -Hrair