Operating System - HP-UX
1846755 Members
4654 Online
110256 Solutions
New Discussion

Need some help for scripting

 
SOLVED
Go to solution
Sandip Ghosh
Honored Contributor

Need some help for scripting

I need to send some specific files to approximately 70 printers. Can any one please guide me to write the script for that?

Sandip
Good Luck!!!
3 REPLIES 3
John Poff
Honored Contributor
Solution

Re: Need some help for scripting

Hi,

Here is one try at it:

#!/bin/sh

PRINTERS="prt1 prt2 prt3"
MYFILES="myfile1 myfile2 myfile3"

for f in $MYFILES
do
for p in $PRINTERS
do
lp -d${p} $f
done
done



Since you have 70 printers, you could put them into a text file, call it PRINTERS, with a line for each printer name. Then you can pull that into a variable for the printer name like this:

PRINTERS=$(
and replace the PRINTERS= line in the script with that.

JP
Leif Halvarsson_2
Honored Contributor

Re: Need some help for scripting

Hi

A variant to John's script.

Send all files to the printers in one request:

#!/bin/sh

PRINTERS="prt1 prt2 prt3"
MYFILES="myfile1 myfile2 myfile3"


for p in $PRINTERS
do
lp -d${p} $MYFILES
done


With this you should have fever print requests running.

Sandip Ghosh
Honored Contributor

Re: Need some help for scripting

Actually these are label printers and the most interesting is that if you send the label formats simultaneously it can't digest. So I have to give a "sleep 10" in between two format.

Anyway thanks to all of you.

Sandip
Good Luck!!!