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