SUMMARY: Setting up multiple printer quickly

From: lawries@btinternet.com
Date: Wed Feb 26 2003 - 09:51:00 EST


Thank you to all respondents.
The job is completed!

Thank you to: Werner Rost, Phil Baldwin, Alan davis, Brian Mills and
Mark Deiss. Mark's reply is listed below because the answer was the
most comprehensive although all were along the same lines.

==== Mark Deiss ====

You do not mention if you are dealing with a mix of printers that may
require different filters...

while read LPNAME LPFILTER IPADDRESS
do
(
echo "${LPNAME}:\\" # need to escape the escape
echo " :af=/usr/adm/lpd/${LPNAME}.acct:\\"
echo " :lf=/usr/adm/lpd/${LPNAME}.err:\\"
echo " :if=/usr/lbin/${LPFILTER}:\\"
echo " :of=/usr/lbin/${LPFILTER}:\\"
echo " :sd=/usr/spool/lpd/${LPNAME}:\\"
echo " :lp=:\\"
echo " :mx#0:\\"
echo " :pw#0:\\"
....
....
echo " :pl#66:" # last descriptor for printer entry
does not include a "\"
# you get the idea, put in whatever printcap values you need....
) >> /tmp/printcap.build

if [ ! -d /usr/spool/lpd/${LPNAME} ]; then
mkdir /usr/spool/lpd/${LPNAME}
chown daemon.daemon /usr/spool/lpd/${LPNAME}
chmod 755 /usr/spool/lpd/${LPNAME}
fi

echo "IPADDRESS $LPNAME" >> /tmp/hosts.build

done <<-!
printer1 filter1 ipaddress1
printer2 filter2 ipaddress2
...
...
!

Check the content of /tmp/printcap.build and /tmp/hosts.build. If they look
correct, append printcap.build to /etc/printcap. append hosts.build to
/etc/hosts

cat /tmp/printcap.build >> /etc/printcap
cat /tmp/hosts.build >> /etc/hosts

Bounce the lpd daemon

/sbin/init.d/lpd stop
/sbin/init.d/lpd start

run lpstat to see what is status on everything.

Things that may require some tweaking are how you want to set up networked
printers - some printers may be using port 515, some 9100... whatever. If
there is a lot of variation, you may want to pass the service port flag in
the read list (as defined in your /etc/services file) and use something like
lp=@${LPNAME}/${LPSERVICE_PORT}. If you are using a single filter for all
your printers, then obviously do not need an entry in your read list.

You mention a new server - that may imply you have an old server that has
all 200 spool entries, in that case you may be able to use the old system's
printcap file and only need to build the spool directory. Some sites also
like to nest the accounting and error log files in whatever path so you may
need logic to build any directory structures for that.

Lawrie



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:49:09 EDT