Operating System - HP-UX
1825049 Members
3180 Online
109678 Solutions
New Discussion юеВ

Commands for removing jobs from printer queue

 
SOLVED
Go to solution
Craig A. Sharp
Super Advisor

Commands for removing jobs from printer queue

Hello SA's

I need a simple command to completely clear a printer queue when logged in as a printer control user "pfix".

I know that I can delete everything in the /var/spool/lp/request/xxxx directory to clear the queue, but when logged in as the printer control user "pfix" with groups "user" and "lp", I am not able to delete the files. The files are user "lp" and group "lp" with 440 perms so only root can cleanly delete the files.

I need user "pfix" to be able to delete the files. As the files are created with perms 440, this is a problem. So is there a command that will allow pfix to delete the files or is there a way to change the perm set used when generating the files so that the group user has the rights to delete the file cleanly.

I have written a script to run as pfix to do the task but of course, the files remain due to the 440 perms.

Thanks,

Craig A. Sharp
Roush Industries.
7 REPLIES 7
Bill McNAMARA_1
Honored Contributor

Re: Commands for removing jobs from printer queue

cancel printer-jobnumber

man cancel

Later,
Bill
It works for me (tm)
Joseph C. Denman
Honored Contributor

Re: Commands for removing jobs from printer queue

give pfix access to the lp group?????


...jcd...
If I had only read the instructions first??
Tracey
Trusted Contributor

Re: Commands for removing jobs from printer queue

If you want to cancel everything that is on one printer, use: cancel -e printername
Craig A. Sharp
Super Advisor

Re: Commands for removing jobs from printer queue

Bill,

There are generally jobs from multiple users in the queue. Sometimes, they can number 30-50 jobs. I am thinking that the cancel -e command would work. What do you think?

Joseph,

The user pfix does belong to the group lp but the files that the printing system generates are perm 440 so even user lp cannot delete the files without confirmation.

Craig
Craig A. Sharp
Super Advisor

Re: Commands for removing jobs from printer queue

More info...

I changed my script to use the cancel -e command. I send a print job to the printer as another user. When I run the script and it hits the cancel -e command, it errors and says that i must have root capability to use this option.
Joseph C. Denman
Honored Contributor
Solution

Re: Commands for removing jobs from printer queue

I agree cancel -e printername would probably work for you.

other response.

if you assign pfix to lp group
then
chmod 775 /var/spool/lp/request/printername

rm -f /var/spool/lp/request/printername/* would work.


A million ways to skin a cat............


...jcd...
If I had only read the instructions first??
Craig A. Sharp
Super Advisor

Re: Commands for removing jobs from printer queue

Joseph,

Perfect!!!!

That is what I needed. Changing the perms on the /var/spool/lp/request/xxx dirs did the trick. I had already added pfix to the lp group but had neglected to change the permissions. I was trying to change the perms on the files themselves rather than the directory.

Thanks to all for your replies.

Craig