AIX Bunch of printers queue creation script - HELP


 
Thread Tools Search this Thread
Operating Systems AIX AIX Bunch of printers queue creation script - HELP
# 1  
Old 02-24-2011
Question AIX Bunch of printers queue creation script - HELP

I'd seek for help on how to create a bunch of printers in AIX 6.x or equal or above in one go – say like I have 35 printers to create in 4 different AIX Nodes every month – I currently create it manually like below:-

How can I automatic this creation on all the 4-5 Nodes – not actually automatic at least to manage using a robust script – help is highly appreciated.

Code:
/usr/lib/lpd/pio/etc/piomkjetd mkpq_jetdirect -p 'hplj-5si' -D pcl -q 'mainoffprt01' -D korimg -q ' mainoffprt01ps' -h ' mainoffprt01' -x '9100'


Last edited by Scott; 02-25-2011 at 02:40 PM.. Reason: Removed formatting, added code tags
# 2  
Old 02-25-2011
Use a script

Create a script to do it... Here is one way.
Code:
#!/bin/sh

PRT=`cat prt.add`
for prt in $PRT
do
  /usr/lib/lpd/pio/etc/piomkjetd  mkpq_jetdirect -p 'hplj-5si' -D pcl -q $prt -h $prt -x '9100'
done

Save that as addprinters.sh, and give it execute permissions. chmod u+x addprinters.sh

Now when you want to add multiple printers, do the following:
add each of the printers into the /etc/hosts file (queue name + IP address)
edit prt.add and paste the queue name(s) in there.
finally, run the addprinters.sh script. It will add all of the printers in there, one at a time, all in one go.

As you said you want this done on 4 nodes, that would complicate this script a little, and you'd have to add in extra functionality.

So you could instead create a file and enter in the new info (for importation into the /etc/hosts file) which contains the queue names and IP address. Then just add that into the /etc/hosts file like so. (cat mynewprinters.txt >> /etc/hosts)

Then add this to your script to run before the 'for prt in $PRT' line. To put on the other nodes, simply scp (Secure Copy) the files (prt.add and mynewprinters.txt) to the other nodes, and then run the script on each node (assuming they have the updated addprinters.sh script there already, otherwise, scp that file over to). You could use ssh keys on each server to accomplish this task.

Hopefully I didn't muddy the waters too much now.

PS. You could use rsync to auto-update all the other nodes at the same time too!

Last edited by Scott; 02-25-2011 at 02:41 PM.. Reason: Removed formatting, added code tags
# 3  
Old 02-26-2011
okay - before I implement this script I would like to understand the format or contents / lines to be in "prt.add" ? just the queue names or with ip address - I know it should have only queue names right?
# 4  
Old 02-26-2011
correct

Correct. The prt.add file contains one queue name per line.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

AIX 4.3 - Need help - Printers not working

I am running an old IBM P-Series server running AIX 4.3 (I know a dinosaur). The OS has not been updated. We had a hard drive failure last weekend, and I was able to get most of the system back up, however, I have 3 line printers and 3 label printers that I can not get working. I have tried... (2 Replies)
Discussion started by: Patrick.Crocker
2 Replies

2. AIX

Adding print queue in AIX

Hi When I add a print queue in my AIX server I get the below message. enq: (WARNING): 0781-162 Cannot awaken qdaemon (request accepted anyway). enq: errno = 2: A file or directory in the path name does not exist. Added print queue 'CUNE024'. Also when I give a test print the status... (3 Replies)
Discussion started by: newtoaixos
3 Replies

3. Shell Programming and Scripting

File system creation script on AIX 6.1 using while loop

#!/bin/sh echo "VG: " read VG echo "LP: " read LP echo "SAP: " read SAP echo "NUM: " read NUM echo "SID: " read SID while ]; read VG LP SAP NUM SID ; do mklv -y $SAP$NUM -t jfs2 -e x $VG $LP; crfs -v jfs2 -d /dev/$SAP$NUM -m /oracle/$SID/$SAP$NUM ... (14 Replies)
Discussion started by: arorap
14 Replies

4. AIX

AIX Print Queue

I am trying to print from Aix 6.1 using a remote queue to a Brother 7360N All in one, I can see the printer, but only output is blank pages. My smit setup is: Name of queue: testprt Hostname if Remote Printer: testprt (I added name to etc/hosts) Name of queue on remote printer: testprt (I... (4 Replies)
Discussion started by: Al Metz
4 Replies

5. AIX

Help with clear printer queue script in AIX 5.3

Good day UNIX forum, could you help me with my clear printer queue script, i have problems with the consistency of this function, sometimes it works sometimes it doesn't. Thanks in advance } preRemovePrintQ(){ clear; echo; echo... (1 Reply)
Discussion started by: beware187
1 Replies

6. Shell Programming and Scripting

Script for adding few methods to bunch of Java files

Hi I have around 1000+ java file under different folder in /home/raxit/source and in each file i want to add a fix method. -------- /* Some comment for few lines like header block etc.. */ package import class A { method1 () { } method2 () (3 Replies)
Discussion started by: raxitsheth
3 Replies

7. AIX

AIX Printers moved to anothere AIX system

AIX Printers need to be moved to another system Guy's We have two servers old AIX 5.2 and new AIX 6.1 the old server has more than 300 printers installed with different configurations I'd like to move all the printers from the old server to the new server with fast steps it's... (1 Reply)
Discussion started by: ITHelper
1 Replies

8. AIX

Interface drivers for printers under AIX 5.3 or above

Hello, Under Linux (Cups) you can place an interface driver in: /etc/cups/interfaces .. which allows you to intercept printouts to a certain printer and then carry on with the printer. Is there a similar function under AIX? Thanks, (0 Replies)
Discussion started by: stuaz
0 Replies

9. AIX

Multiple printers to a print queue

Hello I created a print queue on my AIX 5 server. Unfortunetly, I already had a print queue with that name, so now I have 2 printers connected to one print queue. I see the option in smit to add another printer to a queue, but I do not see how to remove one. Anyone know the secret?? ... (3 Replies)
Discussion started by: mhenryj
3 Replies

10. AIX

AIX 5 print queue

I have setup a printer and queue using SMIT and I have set the default tray to 4. What I am trying to find out is if there is a way to set the next tray it trys to use if tray 4 is empty to tray 3, then tray 2, then tray 1. (0 Replies)
Discussion started by: chefsride
0 Replies
Login or Register to Ask a Question