Thanks to you kind people on the list I learned how to debug and fix the bin/faxrcvd script with Hylafax.

The solution was to use "/usr/local/bin/ps2pdfwr" instead of /usr/local/bin/ps2pdf. Apparently some enviroment info got lost during script execution, something that I think I've seen before with scripts written under Linux and then used with FreeBSD?

Now the next one:
We want to use a script from http://www.purpel3.com/sambafax/ to extract a fax number from a print through CUPS like:
app--->cups--->sambafax script--->sendfax

The problem here seems to be a mysterious "permission denied" error that can be seen in the CUPS error log below (which is probably going to look weird). A tmpfile is created ok then not much more happens.

Then follows a stripped version of the script with just the necessary parts.

CUPS log:

[18/Feb/2003:09:28:32 +0100] [Job 192] FAXNUM=`${FAXFILE} | ${AWK} '{ IGNORECASE=1 } /FAX-Nr ?: ?[0-9-]*/ \
D [18/Feb/2003:09:28:32 +0100] [Job 192] { $0=$0 "xxx"; \
D [18/Feb/2003:09:28:32 +0100] [Job 192] gsub(/-/,""); \
D [18/Feb/2003:09:28:32 +0100] [Job 192] anfang=match($0,/ ?: ?/); \
D [18/Feb/2003:09:28:32 +0100] [Job 192] anfang=anfang+match(substr($0,anfang),/[0-9]/)-1; \
D [18/Feb/2003:09:28:32 +0100] [Job 192] ende=match(substr($0,anfang),/[^0-9]/)-1; \
D [18/Feb/2003:09:28:32 +0100] [Job 192] printf ("%s",substr($0,anfang,ende)) \
D [18/Feb/2003:09:28:32 +0100] [Job 192] }'`
D [18/Feb/2003:09:28:32 +0100] [Job 192] + /tmp/sambafax/sambafax.87654+ /usr/local/bin/gawk
D [18/Feb/2003:09:28:32 +0100] [Job 192] { IGNORECASE=1 } /FAX-Nr ?: ?[0-9-]*/ { $0=$0 "xxx"; gsub(/-/,""); /usr/local/libexec/cups/backend/sambafax.cups: /tmp/sambafax/sambafax.87654: permission denied
D [18/Feb/2003:09:28:32 +0100] [Job 192] anfang=match($0,/ ?: ?/); anfang=anfang+match(substr($0,anfang),/[0-9]/)-1; ende=match(substr($0,anfang),/[^0-9]/)-1; printf ("%s",substr($0,anfang,ende)) }
D [18/Feb/2003:09:28:32 +0100] [Job 192] + FAXNUM=
D [18/Feb/2003:09:28:32 +0100] [Job 192] if [ "${FAXNUM}" = "" ] ; then
D [18/Feb/2003:09:28:32 +0100] [Job 192] echo "Please correct and retry"

Script to extract fax number:

#!/bin/sh -xv
SENDMAIL="/usr/sbin/sendmail"
AWK="/usr/local/bin/gawk"
SENDFAX="/usr/local/bin/sendfax"

umask 000;
FAXFILE=/tmp/sambafax/sambafax.$$
cat >${FAXFILE} # this comes from the pipe (local mission)
cat $6 >>${FAXFILE} # or this comes from samba as a file
FAXNUM=`${FAXFILE} | ${AWK} '{ IGNORECASE=1 } /FAX-Nr ?: ?[0-9-]*/ \
{ $0=$0 "xxx"; \
gsub(/-/,""); \
anfang=match($0,/ ?: ?/); \
anfang=anfang+match(substr($0,anfang),/[0-9]/)-1; \
ende=match(substr($0,anfang),/[^0-9]/)-1; \
printf ("%s",substr($0,anfang,ende)) \
}'`
if [ "${FAXNUM}" = "" ] ; then
echo "Please correct and retry"
else
${SENDFAX} -n -D -f ${MailTo} -d ${FAXNUM} ${FAXFILE}
fi


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message

Reply via email to