I am using a script to cancel all jobs in a virtual printer queue.
I have found the command cancel but I need to supply the request-id for
each job in the queue.
using
cancel printer
will only cancel currently printing jobs - if the queue is disabled
then the jobs are not printing and no jobs are cancelled.
How can I use the command line to cancel all existing jobs for a given
printer?
Any useful suggestions grteatly appreciated.
James
Sent via Deja.com
http://www.deja.com/
You didn't mention what product you have which can make a difference.
You said command line, in which instance, "scoadmin print job manager"
is the logical answer.
Then you said from a script, which would indicate you should read the
man page for lpstat because background information is always helpful.
I can't decide if this is homework so I'll give the logic and we'll
critique your efforts. :-)
run lpstat -o to get a list of all pending print jobs
use awk or other tool to get just those you need
invert the list (bonus points for guessing why you do this)
loop though the list, cancelling each one.
--
==========================================================================
Tom Parsons t...@tegan.com
==========================================================================
Try:
-- cut --
for job in `lpstat -o your_printer | awk '{print $1}'` ; do
cancel $job
done
-- cut --
--
Best regards,
Igor Istlentiev
Voronezh Savings Bank
There's a TA for this, 103239, first issued in 1991.
--
JP
It doesn't kill in LIFO order so as each job is killed, the next one tries
to get to the printer, creating unnecessary thrashing and sometimes
undesirable results.