1834798 Members
2778 Online
110070 Solutions
New Discussion

Network printing

 
SOLVED
Go to solution
alex1982
Frequent Advisor

Network printing

Hi,
i am a new unix system administrator.
I have a question regarding network printing from a Unix server.
How is it possible to print with a single command to a network printer ( maybe using its IP address), without having to install it first on the Unix Server.
Is there something similar to the LPR command used in Windows, to print to a network printer?
(In Windows we don't have to install the printer ).
Can this be done with printers that are installed and shared on a Windows computer.
How can we print with a single command from Unix to a Windows shared printer, without having to install it first.

Any help would be appreciated.
Regards
20 REPLIES 20
Ganesan R
Honored Contributor

Re: Network printing

Hi,

To the best of my knowledge it is not possible. Either you need to configure as a network printer(if it is connected on network) or remote printer (if it is shared from windows) on unix server first.
Best wishes,

Ganesh.
killer1
Advisor

Re: Network printing

Hi Alex

The following link may give you a brief Idea about the process of printing between UNIX and Windows.

http://www.stethos.com/megaform/data/HowToPrintFromUnixHPUX-HP9000ToNT.pdf

Regards
alex1982
Frequent Advisor

Re: Network printing

Thank you.
I saw the document but it includes installing a network or remote printer with SAM.
I wish to avoid this and print by an only command to a remote printer.

Thank you
OFC_EDM
Respected Contributor

Re: Network printing

Hi Alex,

Why do you want to avoid setting up an LPR printer on the Unix host?

Once you do it once you'll find it's quite easy.

Once the LPR is setup it will simply be
lp filename
to print to the default printer.

Then it's
lp -d {destination} filename
to print to a different printer
The Devil is in the detail.
Matti_Kurkela
Honored Contributor
Solution

Re: Network printing

The standard HP-UX installation does not include a tool that can do it directly, but of course you can install one that is available for free:

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/rlpr-2.06/

For a better introduction to this utility, see the author's web page:
http://truffula.com/rlpr/

MK
MK
OFC_EDM
Respected Contributor

Re: Network printing

Which version of HP-UX are you running?

Here's a link to the lpadmin command which can also be used to create the printer

http://docs.hp.com/en/B2355-90691/lpadmin.1M.html

It has an example of setting up a remote printer

/usr/sbin/lpadmin -plp3 -v/dev/null -mrmodel -ocmrcmodel -osmrsmodel -ob3 -ormsystem2 -orplp -v/dev/null

To a Windows admin this may look messed up but read the options in the man page using the link above and it will all make sense.
The Devil is in the detail.
alex1982
Frequent Advisor

Re: Network printing

I am using HP-UX.B11.23
I have already set up one remote printer
and i can print to it using
lp filename
but the company is using an application that needs to print to a range of network printers with different ip address-es and it is a strugling job to install all these remote printers to unix.
Does the command lp {destination} filename work with only one printer set up on Unix application server.It is not working for me until now.

OFC_EDM
Respected Contributor

Re: Network printing

lp -d {destination} is when you have more than one printer. As you can specify the name of the printer where the job should be sent.

If you don't use the -d option the command will print to the "default" printer.

The default printer can be setup I believe with "lpadmin -d printer_name".
The Devil is in the detail.
alex1982
Frequent Advisor

Re: Network printing

This is why i would like to know how to print to a network printer without having to install it using sam first , because i have a long list of printers to install.
OldSchool
Honored Contributor

Re: Network printing

"long list of printers to install"....

so? thats NOT the same as what you asked. It is possible to script the installation and avoid sam...

now the question is, is really a remote printer (like lpr, sends info to print server for processing), or is it an network printer (JetDirect card in printer)?
alex1982
Frequent Advisor

Re: Network printing

It is both of them.
I have a list of remote printers, which means printers shared in Windows clients, that i have to print to from Unix.
I also have a list of network printers(JetDirect) that i have to print to from Unix.
alex1982
Frequent Advisor

Re: Network printing

If it is not possible to print to a network or remote printer using only one command,
can you help me with a script that installs the printers avoiding sam.

Regards
OFC_EDM
Respected Contributor

Re: Network printing

Hi Alex,

You'll have to determine the printer command yourself. If you post your command attempts we'll comment.

Once you have THE command you want to use to setup all printers then you can modify the script I've attached. I've assumed you're new to scripting and provided a very simplistic sample.

It reads from a source file which would have all your printer names. One per line and no blank lines.
Example:
printer1
printer2
etc
etc

The attached "ReadListOfPrinterNames.ksh" script shows how to read in the file and how to use a variable containing the printer name in a command. I used the "echo" command to simply write the printer name to the console.

Note this is a Korn Shell script and the use of {} around the variable name.

Take a stab at writing the script with the lpadmin command and we'll help you out further if needed.

Regards,
Kevin
The Devil is in the detail.
Dennis Handly
Acclaimed Contributor

Re: Network printing

>Kevin: The attached "ReadListOfPrinterNames.ksh" script shows how to read in the file and how to use a variable containing the printer name in a command.

You might want to show an example without the evil cat. :-)

while read PRINTERNAME; do
echo "Found printer ${PRINTERNAME}"
done < testfile.txt

for PRINTERNAME in $(< testfile.txt); do
echo "Found printer ${PRINTERNAME}"
done
OFC_EDM
Respected Contributor

Re: Network printing

Thanks Dennis. Cats are evil. And with Halloween coming up we should avoid them at all costs! :)
The Devil is in the detail.
alex1982
Frequent Advisor

Re: Network printing

Thank you Kevin.
In fact, i just downloaded and installed rlpr , and i am searching for the correct syntax to use for printing on a remote printer(Windows shared printer) or a network printer with its own IP address.

Can you help me out?
alex1982
Frequent Advisor

Re: Network printing

Everything ok.
I tested rlpr and it works fine.
It can print to network printers and also remote printers.

Thank you all .
alex1982
Frequent Advisor

Re: Network printing

rlpr was the solution to my problem
OFC_EDM
Respected Contributor

Re: Network printing

Hi Alex,

Just a reminder that a thank you in the forums is in the form of points. Not that I care really but it is the etiquette to use here.

And I've noticed a LOT of people seeking and getting advice without taking the simple step of assigning points.

And points don't go to just those that found the solution. But also to those who took the time out of their day and made an effort to help.

Here's the guide to the points.
o 1-3: The answer didn't really help answer my question, but thanks for your assistance!

o 4- 7: The answer helped with a portion of my question, but I still need some additional help!

o 8-10: The answer has solved my problem completely! Now I'm a happy camper!

Glad you got your solution.

Best Regards,
Kevin
The Devil is in the detail.
alex1982
Frequent Advisor

Re: Network printing

I have replied before saying "thank you" and also assigned points to the user that i think helped me most.

I am new to the forum , and i assumed i had to assign the points to only the best answer.
Now that i know, i will also assign points to other users.

Thank you Kevin.