20231019 备份

This commit is contained in:
hehaoyang 2023-10-19 15:39:03 +08:00
parent 0e9b1cc5a5
commit f7bb4ebe19
7 changed files with 225 additions and 164 deletions

View File

@ -0,0 +1,5 @@
# 动态查看文件
```
tail -f 文件名
```

View File

@ -0,0 +1,56 @@
# 打印脚本
* printer.sh
```
#!/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
# 打印机驱动重新加载成功
PrintPhoto DS-RX1HS $1
echo "TRUE"
else
# 打印机驱动重新加载失败
echo "FALSE"
fi
else
# 打印机不存在
echo "FALSE"
fi
```