这是笔者的原创,需要的朋友请顶一下。
# 撤销所有的系统打印请求
# canall by melove 97年5月
PRINT=`lpstat -u|wc -l`
if test $PRINT -eq 0
then
echo "\nSORRY! 无系统打印请求可撤销!!\n"
exit 0
fi
echo "\n正在撤销所有的系统打印请求...\c"
SHU=0
ID=`lpstat -u|awk -F " " '{print $1}'`
for lpid in $ID
do
cancel $lpid >/dev/null 2>&1
SHU=`expr $SHU + 1`
done
echo "\n\nOK! 共撤销 $SHU 个系统打印请求!!\n"
irontech 回复于:2004-07-21 15:33:21 |
FYI,
I'm not sure the script works or not. In my environment, I have local printer (use ftp printing), remote printer, hp & axis printer server printer. I couldn't use normal command to cancel the print job, coz it takes quite some long time to finish or sometime couldn't cancel print Q. What I do is go /usr/spool/lp/temp & /usr/spool/lp/request delete off all files (This is for local & hp/axis printers) /usr/spool/lp/printername delete off all files (this is for remote printer) restart the printer services will do. |
melove 回复于:2004-07-21 17:49:09 |
对不住,我不是很了解你的意思。能用中文说明白吗? |
simonzhan 回复于:2004-07-21 17:59:01 |
[quote:1026fe090c="irontech"]FYI,
I'm not sure the script works or not. In my environment, I have local printer (use ftp printing), remote printer, hp & axis printer server printer. I couldn't use normal command to ..........[/quote:1026fe090c] the above script may not works for the remote printer, IMO. |
melove 回复于:2004-07-21 18:01:32 |
不能撤销网络打印请求。这个我倒没试过,对不住了。 |
dolphinyao 回复于:2004-07-21 18:02:41 |
[quote:5ec0ae7df4="melove"]这是笔者的原创,需要的朋友请顶一下。
# 撤销所有的系统打印请求 # canall by melove 97年5月 PRINT=`lpstat -u|wc -l` if test $PRINT -eq 0 then echo "\nSORRY! 无系统打印请求可撤销!!\n" ..........[/quote:5ec0ae7df4] 很高兴看到你的SHELL,我觉得对我的帮助不小,但是我不明白的是你这个SHELL文件该怎样执行呢? 我的意思是比如: #sh 文件名--- 这个文件名是什么?是不是只要执行这个 sh命令就可以撤消任何打印文件了呢? 还是执行 #canall by melove 年月日 就可以了呢? 谢谢指点迷津!我是刚刚开始学UNIX的,也许问题比较幼稚,请你不要笑我 谢谢! |
sdccf 回复于:2004-07-21 18:04:07 |
不错啊,这是我的:
clear echo " " echo "系统将要终止打印机进程" lpstat -u >/etc/pp if [ -s /etc/pp ] then list=`cat /etc/pp | awk ’{print $1}’` echo "请稍候......" for jjj in $list do cancel $jjj done else echo "" echo "\007没有打印机进程!!!" fi prompt read key } |
melove 回复于:2004-07-21 18:38:14 |
用vi输入我东西,并给它取一个文件名,比如 canall
然后给它执行权 chmod 755 canall 并把它放在/usr/bin/目录下 直接在提示符下 canall 就可以了。 |
melove 回复于:2004-07-21 19:29:28 |
请问版主,可以加精吗? |
melove 回复于:2004-07-28 18:20:39 |
up |
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/