- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Pipe for multiple printer!
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2003 07:23 PM
12-25-2003 07:23 PM
Pipe for multiple printer!
# more $$.txt|lp -d lj5_1
But I want to print this file to multiple printer , how to?
Note that pipe-use is necessary because $$.txt file is generate from an application and is temporary.
===================================
The following is the reason why I must do this!
I have an application! I setup the printer in the application like this:
Printer-Name UNIX-Command
lj5acc lp -d lj5_1 -onb
lj5pur lp -d lj5_2 -onb
When selecting the printer, I can only select lj5acc or lj5pur. I guest it print the job use pipe like this:
# cat jobs|lp -d lj5_1 -onb
Now one user request that he must print his file to lj5_1 & lj5_2, so how can I make "UNIX-Command" for this task?
Very sorry for my poor English!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2003 12:29 AM
12-26-2003 12:29 AM
Re: Pipe for multiple printer!
my suggestion, if works the way you think.
#!/bin/ksh
> /tmp/${$}.tempout
while read LINE
do
echo ${LINE} >> /tmp/${$}.tempout
done
lp -d printer1 /tmp/${$}.tempout
lp -d printer2 /tmp/${$}.tempout
lp -d printer3 /tmp/${$}.tempout
rm /tmp/${$}.tempout
if the programme just uses lp -d lj5_1 -onb
with the file to print as parameter:
#!/bin/ksh
lp -d printer1 ${1}
lp -d printer2 ${1}
lp -d printer3 ${1}
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2003 11:21 AM
12-26-2003 11:21 AM
Re: Pipe for multiple printer!
But I think it won't work!
When use a shell program , it will replace the whole shell to the "UNIX-Command" , just like this:
# more jobs|#/usr/bin/ksh while read ....
Of course this can't work!
I'm not sure if this will work:
# more jobs|lp -d lj5_1|lp -d lj5_2
Any other ideas ?
Thank in advanced!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2003 10:07 PM
12-26-2003 10:07 PM
Re: Pipe for multiple printer!
why do you think, it copies the contents of the file to the command line? It cant do it with the lp command, because thats a binary file. Anyway, you may try to trick it by using two shells. One you specify in the configuration, which has just one line:
. ./second_script
In case it copies the contents of the first script, it gets only this line and the rest is in script 2.
have fun,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2003 01:56 AM
12-28-2003 01:56 AM
Re: Pipe for multiple printer!
I can't find any way to specify multiple printers from the command line. My first idea was if "tee" could be used but, it only works with files. There is an enhanced version of tee (xtee) avialable as freeware which can use pipelines. I have not used it myself but it may be an idea.
http://chasseur.usc.edu/pups/manPages/pupsManPages/xtee.1.html#lbAB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2003 03:57 AM
12-29-2003 03:57 AM
Re: Pipe for multiple printer!
Define a new application printer definition for both unix printers that uses the script below.
printer-name unix-command
lp5acc-pur /path/to/script '-dlp5acc -o"nb land c"' '-dlp5pur -onb -oland -oc'
Yes, each printer name and its options are single-quoted together... Do not forget to use -d and -o appropriately. Notice how the options of the first printer are double-quoted within the single-quotes. The second printer separates its options so double-quotes are not needed.
The script:
#!/usr/bin/sh
mytmp=/tmp/${0##*/}.$$
trap "rm -f $mytmp" EXIT
cat - > $mytmp
if [ -s $mytmp ]
then
for p in "$@"
do
eval lp $p $mytmp
done
fi
To preserve the quoting of each printer argument, it is important to double-quote "$@" in the for loop and to use eval to prepare the commandline for lp.
Notice that "cat" is used to slurp the standard input to a temp file. This means that the script is intended to be used in a pipeline, or a single file must be redirected as standard input.