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

Figure 5: Calling UCC:x50-b-boldcupsctl/UCC without parameters lists the CUPS daemon settings.

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.

The Author

For the past 25 years, Harald Zisler has worked with FreeBSD and Linux. He writes articles on technology and data processing for magazines and leads small group courses on both Linux and on databases.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content