If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):
From - Sat Apr 29 08:23:22 2000
Newsgroups: comp.unix.sco.misc
Path: news.randori.com!feed2.onemain.com!feed1.onemain.com!isdnet!skynet.be!oanews!info.usuhs.mil!uky.edu!news.xenitec.on.ca!news
From: Bill Campbell <bill@celestial.com>
Subject: Re: How do I set default printers?
Resent-From: mmdf@xenitec.on.ca
Submit-To: scomsc@xenitec.on.ca
Content-Type: text/plain; charset=us-ascii
Reply-To: bill@celestial.com
Organization: [resent by] The SCOMSC gateway and Propagation Society
Date: Fri, 28 Apr 2000 18:17:50 GMT
Message-ID: <20000428111750.A6666@kstarr.celestial.com>
Mime-Version: 1.0
In-Reply-To: <qejjgso6poqtro30i606jfm5sbg8nrijf3@4ax.com>; from jeffl@comix.santa-cruz.ca.us on Fri, Apr 28, 2000 at 10:52:04AM -0700
References: <nYhO4.9849$9A6.55224@typhoon.tampabay.rr.com> <yJjO4.10289$9A6.56093@typhoon.tampabay.rr.com> <qejjgso6poqtro30i606jfm5sbg8nrijf3@4ax.com>
Sender: news@xenitec.on.ca (xenitec.on.ca News Administrator)
Precedence: list
Lines: 55
Xref: news.randori.com comp.unix.sco.misc:59126
X-Mozilla-Status: 8010
X-Mozilla-Status2: 00000000
On Fri, Apr 28, 2000 at 10:52:04AM -0700, Jeff Liebermann wrote:
>On Fri, 28 Apr 2000 17:18:22 GMT, "jmt" <jmtcode@hotmail.com> wrote:
>
>>I forgotten to mention if the running application has the printer name
>>hardcoded into there application to which printer to print to, how can I
>>change that printer? I know what the printer name is, just need to redirect
>>there print job to another printer name.
>
>If your unspecified application has something like:
> lp -d printer_name
>imbedded in some configuration file, then you're stuck. It takes priority
>over $LPDEST and over the print spoolers default printer.
>
>However, I know of no application, written by mortals, that cannot be
>twisted into doing what I want it to do. First, find the configuration file
>that goes with your unspecified application, and see if you can find the
>place where the printer is defined. If it looks like:
I have a system that does exactly that. I have a file, /etc/printers
that has entries mapping logical printer names to real printer names,
and the system on which to print them. The file looks like this:
default laser localhost
laser laser localhost
oldprn printer someotherhost
...
I then have /usr/local/bin/lp that's in the PATH before /usr/bin/lp
and further I move the original /usr/bin/lp to /usr/bin/lp.original,
and link it to /usr/local/bin/lp to make sure that everybody uses it.
My script then reads the /etc/printers file, and maps the printer name
to the real printer. If the printer's local, then it forwards the job
to the local with a pipe to ``/usr/bin/lp.original -ddestination''.
If it's a different system, then it pipes to the remote system using:
"|ssh someotherhost /usr/local/bin/lp @ARGV"
This is in perl so it passes the appropriate arguments to the remote
system's /usr/local/bin/lp program which goes through exactly the same
process. It would even be possible to have the job get in a loop if
each system redirected the job to the other (I suppose this could be
done intentionally if there were a printer problem, breaking the loop
when the printer was working again :-).
Bill
--
INTERNET: bill@Celestial.COM Bill Campbell; Celestial Systems, Inc.
UUCP: camco!bill PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/
Cutting the space budget really restores my faith in humanity. It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation.
-- Johnny Hart
Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)
| Views for this page | ||||
|---|---|---|---|---|
| Today | This Week | This Month | This Year | Overall |
| 2 | 5 | 4 | 182 | 2,342 |
/Bofcusm/330.html copyright 1997-2004 (various authors) All Rights Reserved
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Add your comments
comment on this page here