File backend to replace existing pin printers

Calvin Gordon calvin.gordon at sasktel.net
Thu Sep 18 15:12:29 PDT 2008


I'm trying to replace a couple pin printers that print a 3 copy form from an older SCO application that will not print to a shared printer, but will print to an IP number on port 9100.

>From advice found on other forums:
1. I created the service to accept input on 9100
jetdirect 9100/tcp laserjet hplj #

2. and put the following into /etc/xinetd.d/jetdirect

service jetdirect
{
socket_type = stream
protocol = tcp
wait = no
user = lp
server = /usr/bin/lp
server_args = -d filewriter -o raw
groups = yes
disable = no
}

3. Then from http://osdir.com/ml/printing.cups.devel/2004-10/msg00007.html
created /usr/lib/cups/backend/filewriter

#!/bin/bash
# (c) Kurt Pfeifle, Danka Deutschland GmbH
# test for 5 or 6 parameters
FILE=$6 || FILE="-";

LOG=/tmp/filewrite.log; export LOG ;
JOBID=$1 ;
USER=$2 ;
TITLE=$3 ;
COPIES=$4 ;
OPTIONS=$5 ;
PID=$$ ;
echo ${FILE}    >> ${LOG} ;
echo ${JOBID}   >> ${LOG} ;
echo ${USER}    >> ${LOG} ;
echo ${TITLE}   >> ${LOG} ;
echo ${COPIES}  >> ${LOG} ;
echo ${OPTIONS} >> ${LOG} ;
if [ $# -eq 0 ]; then
   echo "direct filewrite \"Unknown\" \"Print any job to file specified in
device-URI\""
   exit 0
fi
if [ $# -ne 5 -a $# -ne 6 ]; then
   echo ""
   echo "Usage: filewrite job-id user title copies options [file]"
   echo "       example for device-URI: 'filewrite:/path/to/targetfile'"
   echo "(this writes the printfile to disk at specified path)"
   echo ""
   echo "Install a printqueue with 'lpadmin -p <filewriter-printer-name> \
-v filewrite:/</path/to/targetfile> -E [-P /path/to/PPD]"
   echo ""
   exit 1
fi
TARGETFILE=${DEVICE_URI#filewrite:}
GREPSTRING="not accepting" ;
if  lpstat -a $TARGETFILE | grep "$GREPSTRING" &> /dev/null ; then
        echo "ERROR: printer $TARGETFILE not accepting jobssss...."
        exit 1
fi
cat $FILE > $TARGETFILE
exit 0

4. and created a printer named filewriter
 lpadmin -p fileprinter -v filewrite:/tmp/my_print_testfile.prn -E

restarted all the services, etc.

Now, i am accepting the print jobs, the go into the filewriter que, but are not processing to a file, not is the log file mentioned inthe backend above being created.

With Debug on, the Cups error log shows me:

I [18/Sep/2008:16:04:08 -0600] Resuming new connection processing...
D [18/Sep/2008:16:04:09 -0600] Report: clients=0
D [18/Sep/2008:16:04:09 -0600] Report: jobs=39
D [18/Sep/2008:16:04:09 -0600] Report: jobs-active=0
D [18/Sep/2008:16:04:09 -0600] Report: printers=7
D [18/Sep/2008:16:04:09 -0600] Report: printers-implicit=0
D [18/Sep/2008:16:04:09 -0600] Report: stringpool-string-count=1011
D [18/Sep/2008:16:04:09 -0600] Report: stringpool-alloc-bytes=9384
D [18/Sep/2008:16:04:09 -0600] Report: stringpool-total-bytes=19272
D [18/Sep/2008:16:05:46 -0600] cupsdAcceptClient: skipping getpeercon()
D [18/Sep/2008:16:05:46 -0600] cupsdAcceptClient: 9 from localhost (Domain)
D [18/Sep/2008:16:05:46 -0600] Report: clients=1
D [18/Sep/2008:16:05:46 -0600] Report: jobs=39
D [18/Sep/2008:16:05:46 -0600] Report: jobs-active=0
D [18/Sep/2008:16:05:46 -0600] Report: printers=7
D [18/Sep/2008:16:05:46 -0600] Report: printers-implicit=0
D [18/Sep/2008:16:05:46 -0600] Report: stringpool-string-count=1012
D [18/Sep/2008:16:05:46 -0600] Report: stringpool-alloc-bytes=9408
D [18/Sep/2008:16:05:46 -0600] Report: stringpool-total-bytes=19288
D [18/Sep/2008:16:05:46 -0600] cupsdReadClient: 9 POST / HTTP/1.1
D [18/Sep/2008:16:05:46 -0600] cupsdAuthorize: No authentication data provided.
D [18/Sep/2008:16:05:46 -0600] CUPS-Get-Printers
D [18/Sep/2008:16:05:46 -0600] cupsdProcessIPPRequest: 9 status_code=0 (successful-ok)
D [18/Sep/2008:16:05:46 -0600] cupsdReadClient: 9 POST / HTTP/1.1
D [18/Sep/2008:16:05:46 -0600] cupsdAuthorize: No authentication data provided.
D [18/Sep/2008:16:05:46 -0600] CUPS-Get-Classes
D [18/Sep/2008:16:05:46 -0600] cupsdProcessIPPRequest: 9 status_code=0 (successful-ok)
D [18/Sep/2008:16:05:46 -0600] cupsdCloseClient: 9
D [18/Sep/2008:16:06:22 -0600] cupsdAcceptClient: skipping getpeercon()
D [18/Sep/2008:16:06:22 -0600] cupsdAcceptClient: 9 from localhost (Domain)
D [18/Sep/2008:16:06:22 -0600] cupsdReadClient: 9 POST / HTTP/1.1
D [18/Sep/2008:16:06:22 -0600] cupsdAuthorize: No authentication data provided.
D [18/Sep/2008:16:06:22 -0600] Get-Printer-Attributes ipp://localhost:631/printers/fileprinter
D [18/Sep/2008:16:06:22 -0600] cupsdProcessIPPRequest: 9 status_code=0 (successful-ok)

lpq -a reports
Rank    Owner   Job     File(s)   Total Size
1st     lp      40      (stdin)   3072 bytes

lpstat -p reports
printer fileprinter disabled since Thu 18 Sep 2008 04:07:01 PM CST -
	/usr/lib/cups/backend/filewrite failed

I could use a hint what syntax is causing the prints to hang in the que, instead of being written to file.

Thanks in advance.






More information about the cups mailing list