(http://www.faximum.com/technotes/062)
TITLE: #062 - The Completion Program Feature (Faximum PLUS)
KEYWORDS: completion program sendfax
RELEASE: Faximum ELS/PLUS
CLASSIFICATION: Intel-EP AIX-P
PROBLEM: N/A
CAUSE: User needs more information on the completion program feature of
Faximum.
(This TN applies to the Faximum PLUS product only. For information
on the completion program feature for Faximum Client/Server,
please see TN #198.)
SOLUTION: The first step is to read about the completion-program option in
the manual page for sendfax in Appendix A of the Reference Manual.
Additional hints for using the completion-program include:
- the second argument to the completion program is a text
string indicating the status of the request (i.e. whether
it was successful or not)
- double check that the name of the completion program is a
complete path name with the first part being the home directory
of the user fax (i.e. /usr/fax/...)
- note that the manual is in error when it indicates that you are
responsible for deleting the data files associated with the
request. That is done by Faximum (unless the request has failed
and the system is configured to suspend failed requests, in
which case the control file will be renamed from "cf" followed
by some sequence of letters to "sf" followed by the same
sequence).
You MUST, however, delete the control file (the first argument
to your completion-program) unless you wish to resubmit a
suspended request.
FAILURE TO DO THIS WILL CAUSE THE FAXSCHED PROCESS TO ATTEMPT
TO RESCHEDULE YOUR ALREADY COMPLETED REQUEST.
For safety it is also wise to rename the control file as soon
as you start your completion program to prevent faxsched from
trying to reprocess the request while your completion program
is still in progress. (The sample program below does this.)
- note that the first argument is not a rooted path name so do
not change your current directory within the completion program
before you have either deleted the control file or noted your
current directory
- the control file is an ASCII file containing the parameters
related to the request (print out the contents of any file
in /usr/spool/fax/destinations/*/cf* to get an idea of what
a control file contains)
If you are using the completion program to reactivate a suspended
request (say, after changing the time-to-send parameter) then the
steps to take are:
1. Verify that the request has been suspended (i.e. that
the control file starts with the letters "sf"). If the
request was successful (i.e. the control file starts with
the letters "cf") then presumably nothing need be done
(other than deleting the cf file).
2. Edit the control file to change the desired parameters.
3. Change the name of the control file from sf... to cf...
(where ... represents an arbitrary sequence of letters).
Use the same sequence for the new cf... name as are
present in the existing sf... name.
Here is a sample completion program as a shell script:
----------------------------------------------------------------------------
#
# A sample completion program to print confirmation reports on non-graphics
# printers.
#
if expr `basename $1` : 'cf' > /dev/null
then
mv $1 /tmp/cf.$$
CF="/tmp/cf.$$"
else
CF="$1"
fi
STATUS="$2"
RPT=/tmp/cfm.$$
prt_item() {
value=`grep "$1" ${CF} | sed "s/$1 *= *//"`
v=`eval echo $value`
echo "$2" $v >> ${RPT}
}
echo "\n\n\n" > ${RPT}
echo "********************************************************" >> ${RPT}
echo "** FAX TRANSMISSION REPORT ** FAX TRANSMISSION REPORT **" >> ${RPT}
echo "********************************************************" >> ${RPT}
echo "\n\n" >> ${RPT}
echo " Status: " "$2" >> ${RPT}
echo " Time: " "`date`" >> ${RPT}
echo "\n" >> ${RPT}
prt_item "recipient-name" " Sent to: "
prt_item "recipient-company" " Company: "
prt_item "subject" " Subject: "
prt_item "pages" " Pages: "
phone=`grep "device =" ${CF} | sed "s/device *= *@default://"`
echo " Phone: " $phone >> ${RPT}
lp < ${RPT}
rm -f ${RPT}
rm -f /tmp/cf.$$
----------------------------------------------------------------------------
TechNote: 062 -- Last Updated: Tue Feb 23 01:19:17 PST 1999
Copyright 1996,1999 Faximum Software Inc., All Rights Reserved.
The complete set of Faximum TechNotes are available on the Internet at
http://www.faximum.com/TechSupport
© Copyright 2001 Faximum Software Inc. All Rights Reserved.