printing a file from cron using cups and/or lpd

Greg Rundlett greg at freephile.com
Wed Mar 24 10:07:01 EST 2004


I use a short shell script [see bottom] that produces a nicely formatted 
GNU-style ChangeLog every day (using cvs2cl.pl and cron).  I would like 
to add a print command to the script that cron invokes so that the new 
ChangeLog report is sitting at my printer when I arrive in the office.

I seem to have a problem in my /etc/printcap file that is preventing lpd 
from running.

My question is How do I edit my /etc/printcap file, or the 
/etc/cups/printers.conf file so that lpd can run successfully?

The details....

I use CUPS and KPrinter for my usual printing, but believe that I need 
to use lpr to print from a shell script.  So, I tried lpr.  Here is what 
happened:
lpr /web/dev.buzgate.org/ChangeLog
Status Information:
 sending job 'greg at spidey+347' to spideyPrinter at localhost
 connecting to 'localhost', attempt 1
 cannot open connection to localhost - No such file or directory
Make sure the remote host supports the LPD protocol
and accepts connections from this host and from non-privileged (>1023) ports

I checked to see if lpd was running
ps -aux |grep lpd
and it was not

I looked at my rc scripts to verify that it gets started at boot time
ll /etc/rc.d/rc5.d
[snip]
S60lpd -> ../init.d/lpd
[snip]

which it does, but obviously it was not currently running.  So I tried 
starting it manually
/etc/rc.d/init.d/lpd start
Starting lpd: Warning - spideyPrinter: 'no :rm, :lp, or :sv entry'
Warning - spideyPrinter: Bad printcap entry - missing 'sd' or 'client' 
entry?
Fatal error - Cannot bind to lpd port '515'
                                                           [FAILED]

So I looked at my printcap file
cat /etc/printcap
# This file was automatically generated by cupsd(8) from the
# /etc/cups/printers.conf file.  All changes to this file
# will be lost.
spideyPrinter:


Here are the details of my printer setup from CUPS
cat /etc/cups/printers.conf
# Printer configuration file for CUPS v1.1.17
# Written by cupsd on Thu 18 Dec 2003 03:28:43 PM GMT
<DefaultPrinter spideyPrinter>
Info hp DeskJet 5550
Location Greg's Desk
DeviceURI usb://hp/deskjet%205550?serial=MY29P1N4G32L
State Idle
Accepting Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
</Printer>

While this command ||
|cat /etc/cups/cupsd.conf|grep -v ^#|grep [:alnum:]|
|||reveals the essential parts of my cups daemon configuration|
||
|ServerName spidey.buzgate.org|
|ServerAdmin greg at buzgate.org|
|Classification none|
|DefaultCharset UTF-8|
|DefaultLanguage en|
|Printcap /etc/printcap|
|PrintcapFormat BSD|
|RemoteRoot remroot|
|SystemGroup sys|
|ServerCertificate /etc/cups/ssl/server.crt|
|ServerKey /etc/cups/ssl/server.key|
|<Location />|
|Encryption IfRequested|
|Satisfy All|
|Order deny,allow|
|Deny From All|
|Allow From 127.0.0.1|
|</Location>|
|<Location /admin>|
|AuthType Basic|
|AuthClass System|
|Encryption IfRequested|
|Satisfy All|
|Order deny,allow|
|Deny From All|
|Allow From 127.0.0.1|
|</Location>|
|HostnameLookups Off|
|KeepAlive On|
|KeepAliveTimeout 60|
|MaxClients 100|
|MaxRequestSize 0m|
|Timeout 300|
|Listen *:631|
|AccessLog /var/log/cups/access_log|
|ErrorLog /var/log/cups/error_log|
|PageLog /var/log/cups/page_log|
|MaxLogSize 1m|
|LogLevel info|
|PreserveJobHistory On|
|PreserveJobFiles Off|
|AutoPurgeJobs No|
|MaxJobs 0|
|MaxJobsPerPrinter 0|
|MaxJobsPerUser 0|
|User lp|
|Group sys|
|RIPCache 8m|
|FilterLimit 0|
|DataDir /usr/share/cups|
|DocumentRoot /usr/share/cups/doc|
|RequestRoot /var/spool/cups|
|ServerBin /usr/lib/cups|
|ServerRoot /etc/cups|
|TempDir /var/spool/cups/tmp|
|Browsing On|
|BrowseProtocols CUPS|
|BrowseInterval 30|
|BrowseTimeout 300|
|BrowseAllow 192.168.1|
|BrowseOrder allow,deny|
|ImplicitClasses On|
|ImplicitAnyClasses Off|
|HideImplicitMembers Yes|
|BrowseShortNames Yes

btw, if you're interested in the short shell script that uses cvs2cl.pl 
to generate a daily ChangeLog, here it is

cat createChangeLog.sh
#!/bin/bash

# change to my local cvs repository
cd /home/greg/public_html/dev.buzgate.org
# update this repository from the CVS main repository
cvs -q update -dP
# establish some dates to use in creating messages and ChangeLog
yesterday=`date -d "1 day ago 00:00" -R`
today=`date -d "00:00" -R`
cvsdate=-d\'${yesterday}\<${today}\'
nicedate=`date -d yesterday +"%d %b %Y %Z (%z)"`
filedate=`date -d yesterday +"%Y-%m-%d"`
# run the cvs2cl script, producing the ChangeLog file
/home/greg/public_html/dev.buzgate.org/cgi-bin/cvs2cl.pl -f 
/home/greg/public_html/dev.buzgate.org/public_html/ChangeLog -l "${cvsdate}"
# move yesterday's ChangeLog out of the way on the webserver
mv /web/dev.buzgate.org/public_html/ChangeLog 
"/web/dev.buzgate.org/public_html/ChangeLog${filedate}"
# copy the ChangeLog over to the webserver so people can see it
cp /home/greg/public_html/dev.buzgate.org/public_html/ChangeLog 
/web/dev.buzgate.org/public_html/ChangeLog

|||
||
-- 
FREePHILE
We are 'Open' for Business
Free and Open Source Software
http://www.freephile.com
(978) 270-2425
Your happiness is intertwined with your outlook on life.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20040324/d42a01f6/attachment.html


More information about the gnhlug-discuss mailing list