This document applies to AIX Versions 3.2.5 and 4.x.
This script then requeues the file with the flags on to the virtual printer print queue, which formats the data and sends it to the printer.
Only limited testing has been done to include passing the pitch and rotate flags using qprt. Only one file can be printed from a single print command with this script.
# vi /usr/lib/lpd/pio/etc/archive.sh and 'i'nsert the following #!/usr/bin/ksh # Sample backend archprt designed to archive a file and then print the # same file to another AIX queue. # # DISCLAIMER: This is example code from John Tesch at the AIX Systems # center. This code had not passed any verification testing and is # simply provided as an example of how to start in creating your # own backend. Special customization of this file and questions # concerning customer special needs are considered consulting issues # and will be handled under 'CONSULT LINE' services of the AIX Systems # Center's Support Family. # # This script assumes that there is a count file for each user setup. # This script sets them up in /tmp, but they could be in a /var/spool/count # directory. # It also assumes a PTYPE environment variable in the users .profile # export PTYPE=APPS or similar to designate where file came from. # This is not necessary. If the PTYPE variable is not set, then the # archived files will be username.number # Special attention has been paid to pass print flags to the REAL # print queue, but this has only been tested with qprt on a couple of # flags. # These lines are for debug purposes only. You don't need these in # the working backend. These are primarily included to help the # user understand what is really going on in the rest of the script. # Echo all parameters echo $@ > /tmp/flags.out # Echo the number of parameters echo $# >> /tmp/flags.out # Echo the username who submitted the job echo $USER >> /tmp/flags.out # Echo users PTYPE environment variable. echo $PTYPE >> /tmp/flags.out # Echo base of file name for archive. echo $USER.$PTYPE >> /tmp/flags.out # Echo file name of file being printed. It is always the last argument. eval "echo \$$# >> /tmp/flags.out" # Start of real code, first create unique number for each user. read i < /tmp/$USER.cnt # Always cat the file which is the last parameter # Cat to the archive file username.xxxnumber where xxx is user # environment variable PTYPE. eval "cat \$$# > /tmp/$USER.$PTYPE$i" let i=i+1 echo $i > /tmp/$USER.cnt # Let the job copy before ending which will delete the temp. file. qprt -c -Pasc $@ # The sleep time may need to be adjusted. sleep 10 |
'chmod +x /usr/lib/lpd/pio/etc/archive.sh' 'chgrp printq /usr/lib/lpd/pio/etc/archive.sh'
In AIX 3.2:
smit mkque Add a Local Queue Fill in form: Name of queue, Name of device.., BACKEND PROGRAM pathname Add a Local Queue Type or select values in entry fields. Press Enter AFTER making all desired changes. [Entry Fields] * NAME of queue to add ------> [testq] ACTIVATE the queue? yes + Will this become the DEFAULT queue? no + Queuing DISCIPLINE first come first serve + ACCOUNTING FILE pathname [] * NAME of device to add ------> [testd] BACKEND OUTPUT FILE pathname ------> [FALSE] ACCESS MODE of backend output file write only + * BACKEND PROGRAM pathname ------> [/usr/lib/lpd/pio/etc/archive.sh] Number of FORM FEEDS prior to printing [0] # Print HEADER pages? never + Print TRAILER pages? never + ALIGN pages between files within jobs? yes + Press Enter to add queue. |
smit mkpq other User Defined Backend * Name of QUEUE to add [arch] * Name of QUEUE DEVICE to add [archd] * BACKEND PROGRAM pathname [/usr/lib/lpd/pio/erc/archive.sh] ACTIVATE the queue? yes Should this become the DEFAULT queue? no Queuing DISCIPLINE first come first serve ACCOUNTING FILE pathname [] HOSTNAME of remote server [] Name of QUEUE on remote server [] Pathname of the SHORT FORM FILTER for queue [] status output Pathname of the LONG FORM FILTER for queue [] status output BACKEND OUTPUT FILE pathname [] |
For appid use something to key on when looking for the file. It will be used as part of the file name by the program.
This should show:
Queue Dev Status Job Files User PP % Blks Cp Rnk ------- ----- --------- --- ------------ ---------- ---- -- ----- --- --- testq testd READY |
This shows an example. This file and the writes to it are merely for debugging the backend and can be removed from the archive.sh script once things are working.
/var/spool/qdaemon/tOqYDXr jwtesch APP jwtesch.APP 3
This shows files created.
/tmp/jwtesch.APP2 /tmp/jwtesch.APP3 /tmp/jwtesch.cnt
[ Doc Ref: 9174712158698 Publish Date: Feb. 09, 2001 4FAX Ref: 6454 ]