1753483 Members
4153 Online
108794 Solutions
New Discussion юеВ

Print queues

 
Ramesh_20
Occasional Contributor

Print queues

Can anyone help me in clearing print queues?
7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: Print queues

Try doing a man on "cancel".


Pete


Pete
Michael Steele_2
Honored Contributor

Re: Print queues

# lpstat -t (* list out jobs *)

# cancel job#

Alternatively:

cd /var/spoo/lp
ls FIFO, SCHEDLOCK
lpstat -r (* lp daemon running? *)
lpshut
rm FIFO, SCHEDLOCK, outputq, #lock
>outputq
>log
ps -ef | grep -i lp
kill -9 (* pid from ps -ef *)
lpsched -v
more log
lp -d printer
Support Fatherhood - Stop Family Law
Bruno Ganino
Honored Contributor

Re: Print queues

Use "lpstast" command for display lpname and numberqueue and "cancel" command for clear.
#lpstat -t
#cancel lpname-numberqueue
Bruno
Torino (Turin) +2H
E. Wong
Frequent Advisor

Re: Print queues

To cancel any job, I would suggest to first stop the scheduler. As root do:

# lpshut
# lpstat -t
# cancel "queue_name-job#"

You must cancel each job until it's finally cleared. Then:

# lpsched

This way you ensure no new print jobs are sent to the server while you are cleaning it up.

E.
compute, therefore you are
doug mielke
Respected Contributor

Re: Print queues

configure a printer with device of /dev/null.

When you get aprinter full of clutter, you can lpmove jobs to it to dispose of them.

Geoff Wild
Honored Contributor

Re: Print queues

also try the
cancel -e

That will delete all jobs on a queue.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Larry Basford
Regular Advisor

Re: Print queues

We have used this script since 2000
The mail part was removed to prevent /usr mail from getting rm'd if 2 people used it at once.

ErrSyntax()
{
echo "SYNTAX ERROR: cancelall printername"
exit 1
}
if [ $# -ne 1 ];
then
ErrSyntax
fi

### attempt to stop cancel mail to root
## cp -p /usr/bin/mail /usr/bin/mail.save
## echo "exit 0" > /usr/bin/mail

#
# RESTORE MAIL AT THE END OF SCRIPT
###
#DISABLE THE PRINTER
disable $1
#Stat the jobs to a file
lpstat -o$1|grep $1>/tmp/printjobs
#Cuts out the job
cut -d " " -f 1 /tmp/printjobs>/tmp/printjobs2
#ADD cancel to front of list
cat /tmp/printjobs2|sed 's/^/cancel.11.0 /'>/tmp/printmasscancel
chmod 777 /tmp/printmasscancel
/tmp/printmasscancel
#ENABLE THE PRINTER
enable $1
#CLEANUP

### RESTORE MAIL AT THE END OF SCRIPT
### PUT mail command back
## cp -p /usr/bin/mail.save /usr/bin/mail

rm /tmp/printjobs
rm /tmp/printjobs2
rm /tmp/printmasscancel


### cancel.11.0 is the real cancel program
### our cancel command is a sript to fix a local application call.
Desaster recovery? Right !