ITEM: AP6393L
WANTS TO MOVE JOBS FROM ONE PRINT QUEUE TO ANOTHER
Question:
HOW DO I REDIRECT QUEUED JOBS TO A DIFFERENT QUEUE?
Response:
ENVIRONMENT: AIX 3.2.5, AIX 4.1.x
DESCRIPTION: Somebody has queued jobs in one queue that he/she would
like to queue to a different queue.
For example, queue A is down because of a paper jam. The system
administrator would like to move the jobs to a queue that is up and
running.
ACTION: The solution to changing the queue to which queued jobs goes
depends on the level of AIX.
AIX 4.1.x:
==========
To accomplish the above at AIX level 4.1.x, he/she would do the
following:
At 4.1.x, there is already a way to move jobs from one queue to another
through smit or using the commands:
"enq -Q '\' -\# \"
or
"enq -Q '\' -P '\'"
The path through smit would be:
smit printer
print spooling
Manage Print Jobs
Move a Job Between Print Queues
AIX 3.2.5
==========
To move print jobs from one queue to another at AIX level 3.2.5, the
following can be done:
SPECIAL NOTICES
Information in this document is correct to the best of our
knowledge at the time of this writing.
Please use this information with care. IBM will not be
responsible for damages of any kind resulting from its use.
The use of this information is the sole responsibility of
the customer and depends on the customer's ability to eval-
uate and integrate this information into the customer's
operational environment.
+----------------------------------------------------------+
| |
| NOTE: The information in this document has NOT been |
| verified for AIX 4.1. |
| |
+----------------------------------------------------------+
If there are only a couple of jobs in the queue that need to
be requeued:
cd /var/spool/lpd/qdir
List the contents of the directory (ls).
This directory contains the enqueued pointer files to the print jobs.
Look for the files with the extension of the printer that is down.
The files would appear as nnguest.lp0 where nn is a number, guest
is the user that submitted the job and lp0 is the queue name.
Run "stopsrc -sqdaemon" at the command line.
Change the extension from lp0 to lp1 (mv 00guest.lp0 00guest.lp1)
(Again assuming there is an lp1 queue that is working).
Run "startsrc -sqdaemon" at the command line.
The print job is now in the lp1 queue and will be printed.
on the printer that is up.
The following script will requeue jobs associated with a queue
to another queue.
====================================================================
\#!/bin/ksh
stopsrc -cs qdaemon \# Stop the qdaemon
LIST=`ls /var/spool/lpd/qdir | grep $1` \# those are backticks, not
\# quotes
LPS=`lpstat -p$2 2>/dev/null` \# this variable will be
\# used later to make sure that
\# the queue that the jobs are
\# moving to exists
if [ -z "$LPS" ] \# if the queue does not exist,
\# echo the following string.
then
echo "the queue you are trying to move jobs to does not exist."
else \# since the queue does exist,
\# continue the script.
if [ -z "$LIST" ] \# if there are no jobs associ-
\# ated with the queue jobs are
\# moving from, echo the
\# following string
then
echo "There are no queued files associated with queue $1"
echo "please check the queue name."
else \# otherwise, move the old file
\# name to the new filename.
\# This will change the queue
\# that the jobs go to.
for i in $LIST
do
moveto=`echo $i | sed s/$1/$2/g `
mv /var/spool/lpd/qdir/$i /var/spool/lpd/qdir/$moveto 2>/dev/null
echo $i will be moved to $moveto
done
fi
fi
startsrc -s qdaemon \# start the qdaemon up again.
====================================================================
To run this script, the following syntax would be used:
scriptname \ \
For example, I called the script movethis. The queue that is down is
called jtest and the queue I would like to move those jobs to is called
jamtest. To run the script, I type the following at the command line:
/u/jody/movethis jtest jamtest
The script needs to be executable. Issuing the command:
chmod 700 scriptname
will make it read, write and executable for only the owner of the script.
You may want to put the script in a directory that is in your PATH, or
add the path of the script to your PATH.
Other Scenarios:
----------------
Let's say that there are two machines. Machine A has a remote queue
that sends print jobs to a printer attached to machine B. Now, for
example, the queue on machine B is down, but the remote queue on
machine A shows the status "ready". If the script, movethis, is run
on the server (machine B), this will requeue the jobs.
Here is a different scenario:
The remote queue (machine A) is down, the job is still queued to that
queue. To requeue this job to another queue, the script would need
to be run on machine A (unless machine A is at AIX 4.1.x, in which this
can be requeued via smit). This job will not show up on machine B.
Support Line: WANTS TO MOVE JOBS FROM ONE PRINT QUEUE TO ANOTHER ITEM: AP6393L
Dated: October 1995 Category: N/A
This HTML file was generated 99/06/24~13:30:26
Comments or suggestions?
Contact us