old-www/LDP/LG/issue40/sparks.html

141 lines
7.3 KiB
HTML

<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Replacing Legacy systems with Linux, or, a Tale of Two TTYs LG#38</TITLE>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html>
<META NAME=3D"Keywords" CONTENT=3D"Linux printers linux New Hampshire Lin=
ux print servers">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!--endcut ============================================================-->
<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Replacing Legacy systems with Linux, or, a Tale of Two TTYs</font></H1>
<H4>By <a href="mailto:Bobnhlinux@aol.com">Bob Sparks</a></H4>
</center>
<P> <HR> <P>
We have an old Honeywell Bull Unix system. It uses some proprietary pr=
int servers, which can't be updated, and cost $10k/yr to maintain. The Bu=
ll system can't print to HP JetDirect servers, NetWare, or other Unix sys=
tems. Enter Linux.</P>
<H2>I'm still a newbie</H2>
<P>It wasn't quite as easy as I thought. If it were, we wouldn't need Lin=
ux. The Bull machine prints to BSD style remote print queues. But it woul=
dn't print to Linux. OK, bring out tcpdump. Luckily using the tcpdump opt=
ion host d2 and home, (the names of the Bull and Linux machines), cuts do=
wn the traffic to just what we want to see. Tcpdump showed the Bull machi=
ne trying to get access to the rsh port (514), not the remote printer por=
t (515). However, it didn't show the contents of the packets, so we don't=
know what it was trying to do. Tcpdump -w put the raw packets into a fil=
e. Looking at them with a text editor (on a Win95 machine, SMB shared, an=
other story), showed an error message:&#9;/usr/ucb/lpr, no such file or d=
irectory. </P>
<P>First, create the directory with mkdir /usr/ucb</P>
<P>This meant it was coming in as a tty, looking for lpr in an old place =
We needed a combination of ingredients. Putting a symbolic link from /usr=
/ucb/lpr -&gt;. /usr/bin/lpr solved one part. We had already looked at /v=
ar/log/messages and seen that PAM was rejecting the remote host. Putting =
the Bull machine in the /etc/hosts.lpd and /var/spool/lpd/.rhosts files a=
llowed the remote machine in. </P>
<H2>Rtfm, rtfm, rtfm</H2>
<P>I have to add that many of these answers came from asking on the newsg=
roups and mailing lists. I had read the printing howto, the Printing usag=
e howto, the Linux System Administrators Guide, Network Administrators Gu=
ide, man pages, ad nausium. One of the downsides of Linux being the most =
thoroughly documented system is that there is more documentation to read.=
I still haven't found out how to turn on printer accounting yet. There a=
re some hooks built into the lpd, lpr system, but I don't see anything al=
ready set up. Red Hat's printtool seems to use the /var/spool/lpd/&lt;pri=
ntername&gt;/acct file in the printcap file as af=3D (which is the accoun=
ting file), but then doesn't seem to use it for accounting. In fact, they=
use it to find a .config file, containing user and password information =
for SMB and NetWare queues. This prevents it from being used anywhere but=
in the print spool directory. Aeleen Frisch's "Essential System Administ=
ration", from O'Reilly, mentions that many systems use /var/adm. The Linu=
x/Unix File Hierarchy Standard has a /var/account and /var/log directorie=
s. it doesn=92t mention printer accounting specifically.</P>
<H2>What, telnet to a printer?</H2>
<P>HP JetDirect print servers, it turns out, act like remote Unix systems=
. They have print queues, and you can even telnet to them. Telnet only gi=
ves a configuration menu, not a real OS. So, to print directly to HP prin=
ters, we use the Red Hat printtool to set each printer as a remote Unix m=
achine. Now, the Bull machine prints to a Linux queue, which is defined a=
s a remote queue on the JetDirect server. This allows the Bull machine to=
print to laser printers around the LAN, instead of just the old serial p=
rinters on the old proprietary servers. </P>
<H2>An instant solution</H2>
<P>While in the middle of putting up more servers, a communications line =
went down. This was the line going to the proprietary servers. Instead of=
using this as an excuse to put out more Linux servers, we chose to be pr=
ofessional. This meant providing a quick solution. We put one of the crit=
ical printers on a serial port of a win 95 box, shared it by SMB, then re=
directed the Linux queue via smbprint. Of course, only Linux can both rec=
eive the Bull print queue, and export an SMB queue; but the emphasis was =
on providing a professional solution, rather than just advancing Linux. T=
he rapidity of the solution made Linux look good anyway. We now have perm=
ission to put up more Linux servers. It is in an atmosphere of profession=
al competence, not radicalism. Linux looks better. We then replaced this =
scenario with a dedicated Linux server, putting the printers on serial po=
rts (ttySn) of an old 486 originally destined to be surplussed. JetDirect=
boxes only handle parallel ports. </P>
<P>&nbsp;</P>
<H2>And now, make it smarter</H2>
<P>In order to make it even more stable, we put in a script on the Bull m=
achine, which sees if the print redirector is running. I sometimes use it=
as a demo machine, and these units aren't on uninterruptable power suppl=
ies. We are in a 160 year old building. Stable power is not a given. This=
same idea could apply to different printers on JetDirect servers. If a p=
rinter, server, network cable, hub, or anything else goes down, some prin=
t queues could switch to a nearby printer, and keep on going. After all, =
one of the reasons to use Linux is that it keeps on going under rough con=
ditions.</P>
<P>&nbsp;</P>
<P>#!/bin/sh</P>
<P># shell script to find out what parts of the network are up.</P>
<P># it would be run by cron every so often, for root.</P>
<P># /etc/hosts.pup &amp; /etc/hosts.pdown are identical,</P>
<P># except for the IP address of pdirector.</P>
<P># pprimary is the primary print redirector. psecond is the backup.</P>
<P># /etc/hosts.pup has pdirector with the IP address of pprimary.</P>
<P># /etc/hosts.pdown has pdirector with the address of psecond.</P>
<P># Both pprimary and psecond are running 24x7, and have identical</P>
<P># redirected print queues.</P>
<P>&nbsp;</P>
<P>if { ping -c 1 pprimary &gt;/dev/null }</P>
<P>then</P>
<P>cp /etc/hosts.pup /etc/hosts</P>
<P>else</P>
<P>cp /etc/hosts.pdown /etc/hosts</P>
<P>fi</P>
<P>&nbsp;</P>
<!--===================================================================-->
<P> <hr> <P>
<center><H5>Copyright &copy; 1999, Bob Sparks <BR>
Published in Issue 40 of <i>Linux Gazette</i>, Mid-April 1999</H5></center>
<!--===================================================================-->
<P> <hr> <P>
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
ALT="[ TABLE OF CONTENTS ]"></A>
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A>
<A HREF="./york.html"><IMG SRC="../gx/back2.gif"
ALT=" Back "></A>
<A HREF="./lg_backpage40.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
<!--startcut ==========================================================-->
</BODY>
</HTML>
<!--endcut ============================================================-->