Automating CUPS with shell commands
Managing a Service
The cupsctl
command lets you change cupsd.conf
options during run time. If you call the command without options, it only lists the current settings (Figure 5). Table 5 shows the most important options.
Table 5
Configuring cupsd.conf
Function | Activate | Deactivate |
---|---|---|
Cancel jobs owned by others |
cupsctl --user-cancel-any |
cupsctl --no-user-cancel-any |
Debug logging in the error_log file |
cupsctl --debug-logging |
cupsctl --no-debug-logging |
Display remote printers by any IP address |
cupsctl --remote-any |
cupsctl --no-remote-any |
Share local printers with other computers |
cupsctl --share-printers |
cupsctl --no-share-printers |
Display remote printers |
cupsctl --remote-admin |
cupsctl --no-remote-admin |
The command to specify the protocol for sharing the printer is:
cupsctl 'BrowseLocalProtocols="<Protocol(e)>"'
You must include at least one of the cups, dnssd, lpd, or smb protocols. Multiple entries are separated with a blank space. The operating system and services used on the local network determines which protocol to specify. The default protocol is cups, so each computer on the network equipped with this protocol can see the shared printer. However, this protocol will not work with Windows computers until you add smb.
Conclusion
CUPS shell commands allow you to perform tasks that would otherwise be performed in a graphical front end. By integrating the appropriate commands into shell scripts, you can conveniently automate many tasks required by a print server, with no need for power-hungry add-on applications, such as a web server.
You can even operate the Raspberry Pi print server headless, without monitor or keyboard.
« Previous 1 2 3 4 Next »
Buy this article as PDF
Pages: 6
(incl. VAT)