Cancelling a print job from the Linux command line
I'm trying to cancel a print job in Linux from within an interface script, but I'm not having much luck.  My aim is to move the job to another printer by "lp"ing the job to another device, then cancel the primary print job.  Here is my modest script:



job="$1"

user="$2"

title="$3"

numcopies="$4"

options="$5"

filename="$6"

countme=0

countme=$(grep -c saj $filename)

#echo $countme $filename > /testit/done.txt if [ $countme -gt 0 ] then

     echo "it contains Saj $1 $2 $3 $6 philsprinter-$job" > /testit/done.txt

      lp -dkpicking $filename

      sleep 2

      cancel "$job"

      exit 0

else

#     echo "it does not contain Saj" > /testit/done.txt

      cat "$filename"

fi 



 

The logic appears to work but I can't cancel the original print request.  Is it because the job is too far down the road of printing?  Or is it a user permission thing?Your advice would be appreciated.  I'm using Red Hat Linux and CUPS.



Software/Hardware used:
Linux, CUPS
ASKED: April 6, 2010  2:23 PM
UPDATED: April 7, 2010  7:40 PM

Answer Wiki:
Why do you 'wait' 2 sec with the cancel? If yo are testing to print small jobs, they will have gone "into the printer" before your cancel command is fired. Why don't you start with that, and then do the more time-consuming lp command? Just an idea ....
Last Wiki Answer Submitted:  April 7, 2010  7:40 pm  by  brydell   535 pts.
All Answer Wiki Contributors:  brydell   535 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _