1833777 Members
2430 Online
110063 Solutions
New Discussion

Re: Remote Printing

 
Juan Pena_1
Occasional Advisor

Remote Printing

Hi,

I would like to know How I can I create a device (/dev/printer_name) for a remote or network printer as you know the device assign is (/dev/null).

Does anybody know?

Thanks
8 REPLIES 8
Tony Willis_1
Frequent Advisor

Re: Remote Printing

Is the question -

How do I add a Remote Printer?
or
How do I add a Device File?

Are you adding a unix PS printer or
a Netware, NT network printer?

I do not know how to answer your question.
"Not Today,Nice Try, Next Time"
Patrick Wallek
Honored Contributor

Re: Remote Printing

If you are trying to set up a remote printer or network printer in HP-UX then you do not need a file in /dev for each printer. /dev/null is normal for these remote or network printers. The only time a printer needs a device file is if it is a printer that is attached directly to the machine via a serial or parallel interface.

Otherwise, to create a remote printer, you can just go through the printer setup in SAM and point to the correct remote system and remote printer name. If you are adding a network printer then just go through the JetAdmin software and it will do all of the appropriate set up for you.
Juan Pena_1
Occasional Advisor

Re: Remote Printing

I've created my remote printer and it work fine with lp -dprintername, but I need to assign a device (/dev/printername) so I can write directly to device from a Stored Procedure that I have on my oracle 8 database.

Thanks
Patrick Wallek
Honored Contributor

Re: Remote Printing

Hmmmm......The problem is, I don't think it is possible to create a device file for a network or remote printer.

Could you not send the output to lp from you stored procedure? I would think that this would be possible.
Juan Pena_1
Occasional Advisor

Re: Remote Printing

I can't execute an OS command from a stored procedure en Oracle (lp -dprintername filename). This would have solved all my problems but I can't. If I could only open the remote printer so I can write directly to it, this would solve all my problems.
Ajitkumar Rane
Trusted Contributor

Re: Remote Printing

This could be a wild guess ! but is it not possible to create a link /dev/printername to the file /dev/null?

Thanks
Amidsts difficulties lie opportunities
Bill Hassell
Honored Contributor

Re: Remote Printing

The lp spooler has a classic format that expects a device file, but a remote printer cannot use a device file for the LAN as special software is needed to address the remote system and process the print job. Thus, /dev/null is just used as a placeholder...nothing is sent to the /dev/null file.

The solution is to use a FIFO file. This is a little known but very clever way to connect things together in Unix. Here are the steps, followed by an explanation:

mkfifo myprinter
cat myprinter | lp -d options &

Then run your program and specify the file called myprinter (use a full pathname to myprinter). When the device is closed by the program, the job will be printed. You can test it by simply cat'ing a file to myprinter as in:

cat /etc/profile > myprinter

What a fifo does is to act as a destination as well as a source. The command string:

cat myprinter | lp -d &

starts a read on the FIFO file and it will hang there waiting for data. Now anyone (with permissions to write to this file) can send data to myprinter and when it is done, the FIFO signals the read side that the end of the file has been seen and closes output to the lp command. The & puts all this in the background. You can script this to take place automatically.


Bill Hassell, sysadmin
Juan Pena_1
Occasional Advisor

Re: Remote Printing

Bill Hassell your recommendation worked, but when I try to send a second output to the fifo file it hangs.

These are the steps I took :

1) mkfifo epson880
2) cat epson880 | lp -dprt1 &

What am I doing wrong?