Operating System - HP-UX
1851262 Members
3137 Online
104057 Solutions
New Discussion

Scripts to clear printer queues

 
Craig A. Sharp
Super Advisor

Scripts to clear printer queues

Hi all,

I am looking for help on two print queue issues.

First, I have a script under the login "pfix" that has a selection to allow the help desk to clear printer queues. The selection just cd's to /var/spool/lp/request/"printername" and does an "rm *" and deletes anything in the directory. Hence it clears the queue for that printer. The problem is that some printers can be cleared and others say "permission denied". I am confused as all queues were created in SAM so they are esentially identical except for the specific info such as IP and name.
Why would this be happening. Do I need to change a setting when the printer is created. If so, how can I modify each printer?

Second, I would be interested to see any other scripts (PERL, Shell, etc..) or suggestions on allowing the help desk to clear queues without my intervention. This is a regular function for the help desk and I need to make it as simple as possible. SAM restricted is still a bit to complex.

I have also considered WEBMIN but I am not sure if I want to go this route. I think a script such as what I am already doing with a single selection and enter the printer name to clear is the best route.

Thanks,

Craig
6 REPLIES 6
James Specht
Trusted Contributor

Re: Scripts to clear printer queues

What we do is the same, except, (the big except) I created a menu in SAM for operational tasks and run the tasks as root. Then, in SAM, I give only the created menu to the users. The script prompts for the print queue to "clear". This way you don't have to give out any of the baseline SAM menus.

Hope this helps.

"Everyone can be taught to sculpt: Michelangelo would have had to be taught how not to. So it is with the great programmers."
Robert-Jan Goossens
Honored Contributor

Re: Scripts to clear printer queues

Hi Craig,

How about restricted sam for the helpdesk, you can build a restricted sam with the sam -r command. Take a look at the man pages of sam.

Hope it helps,

Robert-Jan.
Rita C Workman
Honored Contributor

Re: Scripts to clear printer queues

I found giving restricted SAM access to folks in HelpDesk and writing a quick menu program for them worked for us..program attached.

Hope it helps,
Rita
Stanimir
Trusted Contributor

Re: Scripts to clear printer queues

Hi!
Here is small manager-package for
printing system consists of 2
HP-printers.

regards,Stan
Stanimir
Trusted Contributor

Re: Scripts to clear printer queues

Hi!
Here is small manager-package for
printing system consists of 2
HP-printers,written by shell-scripts.

regards,Stan
Craig A. Sharp
Super Advisor

Re: Scripts to clear printer queues

Thanks for the replies. I am playing with restricted SAM but I need to learn how to work with the menus to make additional selections for the printers. I would like to fire off a script from sam that would run as root and clear the queue. As far as I can see, SAM only allows the clearing of individual jobs, not the whole queue. I am sure that I am not correct in that statement :-)

Rita, what user is the script running as? Is it SUDO or do you have your printers set to allow any user to cancel a job?

JS, how do you use this attachment? The extensions are new to me.

One additonal question. Is there a way to modify a printer to allow any user to cancel a job? I think that most of mine require root.

Craig

JS,