Sponsored Content
Operating Systems AIX AIX Bunch of printers queue creation script - HELP Post 302499823 by smurphy on Friday 25th of February 2011 01:08:14 PM
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
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
lpstat(1)							    Apple Inc.								 lpstat(1)

NAME
lpstat - print cups status information SYNOPSIS
lpstat [ -E ] [ -H ] [ -U username ] [ -h hostname[:port] ] [ -l ] [ -W which-jobs ] [ -a [ destination(s) ] ] [ -c [ class(es) ] ] [ -d ] [ -o [ destination(s) ] ] [ -p [ printer(s) ] ] [ -r ] [ -R ] [ -s ] [ -t ] [ -u [ user(s) ] ] [ -v [ printer(s) ] ] DESCRIPTION
lpstat displays status information about the current classes, jobs, and printers. When run with no arguments, lpstat will list jobs queued by the current user. OPTIONS
The lpstat command supports the following options: -E Forces encryption when connecting to the server. -H Shows the server hostname and port. -R Shows the ranking of print jobs. -U username Specifies an alternate username. -W which-jobs Specifies which jobs to show, completed or not-completed (the default). This option must appear before the -o option and/or any printer names, otherwise the default (not-completed) value will be used in the request to the scheduler. -a [printer(s)] Shows the accepting state of printer queues. If no printers are specified then all printers are listed. -c [class(es)] Shows the printer classes and the printers that belong to them. If no classes are specified then all classes are listed. -d Shows the current default destination. -h server[:port] Specifies an alternate server. -l Shows a long listing of printers, classes, or jobs. -o [destination(s)] Shows the jobs queue on the specified destinations. If no destinations are specified all jobs are shown. -p [printer(s)] Shows the printers and whether or not they are enabled for printing. If no printers are specified then all printers are listed. -r Shows whether the CUPS server is running. -s Shows a status summary, including the default destination, a list of classes and their member printers, and a list of printers and their associated devices. This is equivalent to using the "-d", "-c", and "-v" options. -t Shows all status information. This is equivalent to using the "-r", "-d", "-c", "-v", "-a", "-p", and "-o" options. -u [user(s)] Shows a list of print jobs queued by the specified users. If no users are specified, lists the jobs queued by the current user. -v [printer(s)] Shows the printers and what device they are attached to. If no printers are specified then all printers are listed. COMPATIBILITY
Unlike the System V printing system, CUPS allows printer names to contain any printable character except SPACE, TAB, "/", and "#". Also, printer and class names are not case-sensitive. The "-h", "-E", "-U", and "-W" options are unique to CUPS. The Solaris "-f", "-P", and "-S" options are silently ignored. SEE ALSO
cancel(1), lp(1), http://localhost:631/help COPYRIGHT
Copyright 2007-2013 by Apple Inc. 10 September 2008 CUPS lpstat(1)
All times are GMT -4. The time now is 07:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy