V1.10 补充更新 (添加打印执行脚本文件)
This commit is contained in:
parent
b3ff127294
commit
23002915ed
60
printer.sh
Normal file
60
printer.sh
Normal file
|
@ -0,0 +1,60 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo "FALSE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#删除所有的打印任务
|
||||
lprm
|
||||
|
||||
#删除默认打印机
|
||||
lpadmin -x DS-RX1HS
|
||||
|
||||
#查找打印机
|
||||
result=`lpinfo -v | grep direct`
|
||||
if [ -n "$result" ]
|
||||
then
|
||||
directs=`echo $result | cut -d " " -f 2`
|
||||
|
||||
# 重启CUPS服务
|
||||
service cups restart
|
||||
|
||||
# 重新添加驱动
|
||||
lpadmin -p DS-RX1HS -E -v "$directs" -m gutenprint.5.2://dnp-dsrx1/expert
|
||||
|
||||
# 设置默认打印机
|
||||
lpoptions -d DS-RX1HS
|
||||
|
||||
# 激活
|
||||
cupsenable DS-RX1HS
|
||||
|
||||
# 设置为接受作业
|
||||
cupsaccept DS-RX1HS
|
||||
|
||||
# 查询默认打印机
|
||||
result=`lpstat -d | cut -d ":" -f 2`
|
||||
|
||||
if [ -n "$result" ]
|
||||
then
|
||||
# 设置文件格式
|
||||
lpoptions -o StpImageType=$1
|
||||
|
||||
# 设置打印模式
|
||||
lpoptions -o ColorModel=$2
|
||||
|
||||
# 设置打印尺寸
|
||||
lpoptions -o PageSize=$3
|
||||
|
||||
# 打印文件
|
||||
PrintPhoto DS-RX1HS $4
|
||||
|
||||
echo "TRUE"
|
||||
else
|
||||
# 打印机驱动重新加载失败
|
||||
echo "FALSE"
|
||||
fi
|
||||
else
|
||||
# 打印机不存在
|
||||
echo "FALSE"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user