filePro/email from Unix script file

Brian K. White brian at aljex.com
Thu Dec 15 06:30:09 PST 2005


----- Original Message ----- 
From: "Butch Ammon" <butch at rich.srcoils.com>
To: <filepro-list at lists.celestial.com>
Sent: Wednesday, December 14, 2005 3:01 PM
Subject: filePro/email from Unix script file


> Good afternoon,
>
> I am trying to help my Minneapolis office (Super Radiator Coils) with an 
> idea
> they have with filePro on SCO Unix.  I made a real simple script file for 
> them
> to run a filePro report to a /tmp file.  Then immediately email the /tmp 
> file.
>
> But... what happens when the filePro report runs and doesn't happen to 
> select
> any records?  The script file continues and emails a blank report!
>
> Is there a quick way to kill the script file when the records selected is 
> "0"?
>
> example:
> -----------------------------------------------------------------------------
> #/usr/bin/partscheck -  Butch  5/2/02
> #

# when i create files they will be rw-rw-rw-
umask 0

# make a unique temp file name
TF=/tmp/partscheck$$

# create the temp file before fp does (so it doesn't get rw------- owned by 
filepro instead of you)
>$TF

# run the report, use nocodes so that no records = no data
# otherwise no records still has hplaser init sequence
/u/appl/fp/dreport purchase -f partscheck -s partscheck -u -pc nocodes -p 
$TF

# if the file exists and is not zero bytes, then mail
[ -s $TF ] && mail -s "parts check report" 
kari at rich.srcoils.com,linda at rich.srcoils.com < $TF

# clean up
rm -f $TF


You can also check for a given number of lines instead of zero bytes, this 
way the report can have a header or printer init sequence that always 
appears.

# if file is greater than 1 line, then mail
[[ `wc -l <$TF` -gt 1 ]] && mail ...


Brian K. White  --  brian at aljex.com  --  http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro  BBx    Linux  SCO  FreeBSD    #callahans  Satriani  Filk!



More information about the Filepro-list mailing list