Operating System - HP-UX
1833430 Members
3176 Online
110052 Solutions
New Discussion

cancel lp requests as non root

 
SOLVED
Go to solution
Nick D'Angelo
Super Advisor

cancel lp requests as non root

Here we are again and my apologies for duplicating this msg, but I can not find the original.

I have a script that checks for print requests and prompts for the deletion of the job and then is supposed to delete the print job, but it is not working.

here is my script:

echo "Cancel print jobs"
echo "here are the print jobs, please pick one!"
lpstat -o
echo "Enter job name and number exactly as listed above that you want to canc
el"
read $lpans
echo "About to remove print request" $lpans
echo ""
echo "if you are positive that you want to delete this print, please enter Y"
read $lpans1
if $lpans1 = "Y"
then
cancel $lpans
else
echo " pausing 5 "
sleep 5
fi

Suggestions appreciated.
Always learning
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor

Re: cancel lp requests as non root

Hi:

Since you indicate that you are not 'root' you must have constructed the print queue to allow 'cancel' by anyone if you want a user, other than the owner/initiator to be able to cancel.

Regards!

...JRF...
Nick D'Angelo
Super Advisor

Re: cancel lp requests as non root

James,

Yes, as non root. I can cancel the print as myself, nickd but I want to do it through a script so that my co-workers can take care of the mundane unix stuff like cancelling print req's that go astray.
That is why I attached my script.
thanks,
Always learning
harry d brown jr
Honored Contributor
Solution

Re: cancel lp requests as non root

Change your reads and "if" statement like such:

read lpans
read lpans1
if [ $lpans1 = "Y" ]
Live Free or Die
Sachin Patel
Honored Contributor

Re: cancel lp requests as non root

Hi Nick,
If you are not root then you have to setup lpqueue as that other user can cancel jobs.

If you have use option -orc in lanadmin while setup only user can cancel his/her own request. Default is not to restrict cancel command.

Sachin
Is photography a hobby or another way to spend $
Nick D'Angelo
Super Advisor

Re: cancel lp requests as non root

Harry, top points as this pointed me in the right direction.

Thanks to all who replied.

call closed.
Always learning
Ray Krupinski_1
Occasional Contributor

Re: cancel lp requests as non root

I did get your sccript to work a added to ask what printer you want to check.

echo "Enter printer name"
read lpname
echo "Cancel print jobs"
echo "here are the print jobs, please pick one!"
lpstat $lpname
echo "Enter job name and number exactly as listed above that you want to canc
el"
read lpans
echo "About to remove print request" $lpans
echo ""
echo "if you are positive that you want to delete this print, please enter y"
read lpans1
if [ $lpans1 = "y" ]
then
cancel $lpans
else
echo " pausing 5 "
sleep 5
fi