linux 操作系统下cupsdisable命令介绍和使用案例
cupsdisable 命令是 Linux 操作系统中用于禁用 CUPS(通用打印服务)打印机的命令。它允许用户将指定的打印机设置为不可用状态,从而阻止任何新的打印作业被发送到该打印机
cupsdisable 命令概述
基本语法
bash
cupsdisable [options] printer_name
主要功能
- 禁用指定的打印机,使其不再接受打印任务。
- 常用于维护或故障排除期间,防止用户发送打印作业到故障或需要维护的打印机。
常用选项
- -h, --help: 显示帮助信息。
- -U, --user: 指定用于身份验证的用户名。
- -E, --encrypt: 使用 SSL 加密连接。
命令安装部署:
root@meng:~# which cuspdisable
root@meng:~# cuspdisable
Command 'cuspdisable' not found, did you mean:
command 'cupsdisable' from deb cups-client (2.4.1op1-1ubuntu4.10)
Try: apt install <deb name>
root@meng:~# apt install cups-client
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
cups-common libavahi-client3 libavahi-common-data libavahi-common3 libcups2
Suggested packages:
cups cups-bsd smbclient
The following NEW packages will be installed:
cups-client cups-common libavahi-client3 libavahi-common-data libavahi-common3 libcups2
0 upgraded, 6 newly installed, 0 to remove and 224 not upgraded.
Need to get 718 kB of archives.
After this operation, 6126 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main amd64 cups-common all 2.4.1op1-1ubuntu4.10 [253 kB]
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main amd64 libavahi-common-data amd64 0.8-5ubuntu5.2 [23.8 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main amd64 libavahi-common3 amd64 0.8-5ubuntu5.2 [23.9 kB]
Get:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main amd64 libavahi-client3 amd64 0.8-5ubuntu5.2 [28.0 kB]
Get:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main amd64 libcups2 amd64 2.4.1op1-1ubuntu4.10 [263 kB]
Get:6 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main amd64 cups-client amd64 2.4.1op1-1ubuntu4.10 [127 kB]
Fetched 718 kB in 4s (190 kB/s)
Selecting previously unselected package cups-common.
(Reading database ... 75207 files and directories currently installed.)
Preparing to unpack .../0-cups-common_2.4.1op1-1ubuntu4.10_all.deb ...
Unpacking cups-common (2.4.1op1-1ubuntu4.10) ...
Selecting previously unselected package libavahi-common-data:amd64.
Preparing to unpack .../1-libavahi-common-data_0.8-5ubuntu5.2_amd64.deb ...
Unpacking libavahi-common-data:amd64 (0.8-5ubuntu5.2) ...
Selecting previously unselected package libavahi-common3:amd64.
Preparing to unpack .../2-libavahi-common3_0.8-5ubuntu5.2_amd64.deb ...
Unpacking libavahi-common3:amd64 (0.8-5ubuntu5.2) ...
Selecting previously unselected package libavahi-client3:amd64.
Preparing to unpack .../3-libavahi-client3_0.8-5ubuntu5.2_amd64.deb ...
Unpacking libavahi-client3:amd64 (0.8-5ubuntu5.2) ...
Selecting previously unselected package libcups2:amd64.
Preparing to unpack .../4-libcups2_2.4.1op1-1ubuntu4.10_amd64.deb ...
Unpacking libcups2:amd64 (2.4.1op1-1ubuntu4.10) ...
Selecting previously unselected package cups-client.
Preparing to unpack .../5-cups-client_2.4.1op1-1ubuntu4.10_amd64.deb ...
Unpacking cups-client (2.4.1op1-1ubuntu4.10) ...
Setting up cups-common (2.4.1op1-1ubuntu4.10) ...
Setting up libavahi-common-data:amd64 (0.8-5ubuntu5.2) ...
Setting up libavahi-common3:amd64 (0.8-5ubuntu5.2) ...
Setting up libavahi-client3:amd64 (0.8-5ubuntu5.2) ...
Setting up libcups2:amd64 (2.4.1op1-1ubuntu4.10) ...
Setting up cups-client (2.4.1op1-1ubuntu4.10) ...
Adding group `lpadmin' (GID 120) ...
Done.
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Scanning processes...
Scanning linux images...
命令案例;
root@meng:~# cups
cupsaccept cupsctl cupsdisable cupsenable cupsreject cupstestppd
root@meng:~# cupsdisable
root@meng:~# cupsdisable -h
cupsdisable: Error - expected hostname after "-h" option.
Usage: cupsdisable [options] destination(s)
Options:
-E Encrypt the connection to the server
-h server[:port] Connect to the named server and port
-r reason Specify a reason message that others can see
-U username Specify the username to use for authentication
--hold Hold new jobs
root@meng:~# lpstat -p
lpstat: Bad file descriptor
root@meng:~# cupsdisable meng
cupsdisable: Operation failed: server-error-service-unavailable
root@meng:~#