Version : 2021.01

Updated : 2022/02/22 15:15

LCE509 - Printer Management

Contents

  • LCE509 - Printer Management
    • Contents
    • Cups
      • Protocols
      • Packages
      • Daemon
      • The /etc/cups/cupsd.conf File
      • Filters
      • Backends
      • Logs
      • Printers
      • Administration
        • The lpstat Command
        • The lpadmin Command
        • The accept et cupsenable Commands
        • Classes
        • The /etc/cups/printers.conf File
        • The /etc/cups/classes.conf File
        • The cancel Command
        • The lpmove Command
        • Web Interface

Cups

The Common Unix Printing System is a printer management system for Unix and Unix-like operating systems owned by Apple™ who purchased the source code when they hired the main developer, Michael Sweet of Easy Software Products.

Protocols

Cups uses a protocol called IPP on ports udp/631 and tcp/631.

IPP :

  • is an extension of the HTTP protocol,
  • allows administration of CUPS via a web browser,
  • allows the use of URLs to define print spoolers.

Cups is also compatible with:

  • tcp/515 for BSD based systems,
  • tcp/9100 for HP networked JeTDirect printers.

Daemon

cupsd is the CUPS system daemon. When CUPS handles a print job, it first passes it to a filter appropriate for the model of the printer to be used and then to a backend dependant upon the type off connection being used. Communication between CUPS, filters and backends is accomplished through spools and pipes.

Installation

In order to install cups, use dnf:

[root@centos8 ~]# dnf install cups -y

Enable and start the service:

[root@centos8 ~]# systemctl status cups
● cups.service - CUPS Scheduler
   Loaded: loaded (/usr/lib/systemd/system/cups.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:cupsd(8)
[root@centos8 ~]# systemctl enable cups
[root@centos8 ~]# systemctl start cups
[root@centos8 ~]# systemctl status cups
● cups.service - CUPS Scheduler
   Loaded: loaded (/usr/lib/systemd/system/cups.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-06-03 14:06:35 EDT; 4s ago
     Docs: man:cupsd(8)
 Main PID: 32727 (cupsd)
   Status: "Scheduler is running..."
    Tasks: 1 (limit: 23720)
   Memory: 1.9M
   CGroup: /system.slice/cups.service
           └─32727 /usr/sbin/cupsd -l

Jun 03 14:06:35 centos8.ittraining.loc systemd[1]: Starting CUPS Scheduler...
Jun 03 14:06:35 centos8.ittraining.loc systemd[1]: Started CUPS Scheduler.

The /etc/cups/cupsd.conf File

The main configuration file for CUPS is /etc/cups/cupsd.conf. In that file can be found:

  • the port that IPP is listening on,
  • the user account and group used by the CUPS server,
  • the log level,
  • the Browse server configuration used to discover printers on the network,
  • the spool Acces Control Lists,
  • the administration area Access Control Lists.
[root@centos8 ~]# cat /etc/cups/cupsd.conf
MaxLogSize 0
#
# Configuration file for the CUPS scheduler.  See "man cupsd.conf" for a
# complete description of this file.
#

# Log general information in error_log - change "warn" to "debug"
# for troubleshooting...
LogLevel warn


# Only listen for connections from the local machine.
Listen localhost:631
Listen /var/run/cups/cups.sock

# Show shared printers on the local network.
Browsing On
BrowseLocalProtocols dnssd

# Default authentication type, when authentication is required...
DefaultAuthType Basic

# Web interface setting...
WebInterface Yes

# Restrict access to the server...
<Location />
  Order allow,deny
</Location>

# Restrict access to the admin pages...
<Location /admin>
  Order allow,deny
</Location>

# Restrict access to configuration files...
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
</Location>

# Restrict access to log files...
<Location /admin/log>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
</Location>

# Set the default printer/job policies...
<Policy default>
  # Job/subscription privacy...
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default

  # Job-related operations must be done by the owner or an administrator...
  <Limit Create-Job Print-Job Print-URI Validate-Job>
    Order deny,allow
  </Limit>

  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  # All administration operations require an administrator to authenticate...
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>

  # All printer operations require a printer operator to authenticate...
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>

  # Only the owner or an administrator can cancel or authenticate a job...
  <Limit Cancel-Job CUPS-Authenticate-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  <Limit All>
    Order deny,allow
  </Limit>
</Policy>

# Set the authenticated printer/job policies...
<Policy authenticated>
  # Job/subscription privacy...
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default

  # Job-related operations must be done by the owner or an administrator...
  <Limit Create-Job Print-Job Print-URI Validate-Job>
    AuthType Default
    Order deny,allow
  </Limit>

  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
    AuthType Default
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  # All administration operations require an administrator to authenticate...
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>

  # All printer operations require a printer operator to authenticate...
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>

  # Only the owner or an administrator can cancel or authenticate a job...
  <Limit Cancel-Job CUPS-Authenticate-Job>
    AuthType Default
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  <Limit All>
    Order deny,allow
  </Limit>
</Policy>

# Set the kerberized printer/job policies...
<Policy kerberos>
  # Job/subscription privacy...
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default

  # Job-related operations must be done by the owner or an administrator...
  <Limit Create-Job Print-Job Print-URI Validate-Job>
    AuthType Negotiate
    Order deny,allow
  </Limit>

  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
    AuthType Negotiate
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  # All administration operations require an administrator to authenticate...
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>

  # All printer operations require a printer operator to authenticate...
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>

  # Only the owner or an administrator can cancel or authenticate a job...
  <Limit Cancel-Job CUPS-Authenticate-Job>
    AuthType Negotiate
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  <Limit All>
    Order deny,allow
  </Limit>
</Policy>

Filters

Available filters for the version of CUPS being used can be found in the /usr/lib/cups/filter directory:

[root@centos8 ~]# ls /usr/lib/cups/filter
bannertopdf     commandtopclx  gstoraster     imagetoubrl         pdftoraster    rastertolabel  svgtopdf          texttops      xfigtopdf
brftoembosser   commandtops    gziptoany      imageubrltoindexv3  pstops         rastertopclm   sys5ippprinter    texttotext
brftopagedbrf   emftopdf       imagetobrf     imageubrltoindexv4  rastertodymo   rastertopclx   textbrftoindexv3  vectortobrf
cgmtopdf        foomatic-rip   imagetopdf     musicxmltobrf       rastertoepson  rastertopdf    textbrftoindexv4  vectortopdf
cmxtopdf        gstopdf        imagetops      pdftopdf            rastertoescpx  rastertops     texttobrf         vectortoubrl
commandtoescpx  gstopxl        imagetoraster  pdftops             rastertohp     rastertopwg    texttopdf         wmftopdf

Backends

Available backends for the version of CUPS being used can be found in the /usr/lib/cups/backend directory:

[root@centos8 ~]# ls /usr/lib/cups/backend
beh  cups-brf  dnssd  driverless  failover  http  https  implicitclass  ipp  ipps  lpd  ncp  parallel  serial  snmp  socket  usb

Active backends for the server on which CUPS is being used can be found by using the following command:

[root@centos8 ~]# lpinfo -v
network http
network https
network ipp
network ipps
network lpd
network socket
network beh

Backend types are by local liaison type (usb, serial, parallel)or by network protocol:

Backend Description
IPP IPP client
LPD LPD client
SMB SMB client
Socket JetDirect client on port tcp/9100
Pap/cap AppleTalk client

Logs

CUPS logs can be found in /var/log/cups:

[root@centos8 ~]# ls -l /var/log/cups
total 12
-rw-------. 1 root lp 166 Jun  3 14:02 access_log
-rw-------. 1 root lp 166 Jun  3 14:02 error_log
-rw-------. 1 root lp 166 Jun  3 14:02 page_log

Printers

Available printers for the version of CUPS being used can be found by using the following command:

[root@centos8 ~]# lpinfo -m | more
lsb/usr/cupsfilters/Fuji_Xerox-DocuPrint_CM305_df-PDF.ppd Fuji Xerox
drv:///sample.drv/dymo.ppd Dymo Label Printer
drv:///sample.drv/epson9.ppd Epson 9-Pin Series
drv:///sample.drv/epson24.ppd Epson 24-Pin Series
drv:///generic-brf.drv/gen-brf.ppd Generic Braille embosser, 1.0
drv:///cupsfilters.drv/pwgrast.ppd Generic IPP Everywhere Printer
drv:///sample.drv/generpcl.ppd Generic PCL Laser Printer
lsb/usr/cupsfilters/Generic-PDF_Printer-PDF.ppd Generic PDF Printer
drv:///sample.drv/generic.ppd Generic PostScript Printer
drv:///cupsfilters.drv/textonly.ppd Generic Text-Only Printer
drv:///generic-ubrl.drv/gen-ubrl.ppd Generic UBRL generator, 1.0
lsb/usr/cupsfilters/HP-Color_LaserJet_CM3530_MFP-PDF.ppd HP Color LaserJet CM3530 MFP PDF
lsb/usr/cupsfilters/pxlcolor.ppd HP Color LaserJet Series PCL 6 CUPS
drv:///cupsfilters.drv/dsgnjt600pcl.ppd HP DesignJet 600 pcl, 1.0
drv:///cupsfilters.drv/dsgnjt750cpcl.ppd HP DesignJet 750c pcl, 1.0
drv:///cupsfilters.drv/dsgnjt1050cpcl.ppd HP DesignJet 1050c pcl, 1.0
drv:///cupsfilters.drv/dsgnjt4000pcl.ppd HP DesignJet 4000 pcl, 1.0
drv:///cupsfilters.drv/dsgnjtt790pcl.ppd HP DesignJet T790 pcl, 1.0
drv:///cupsfilters.drv/dsgnjtt1100pcl.ppd HP DesignJet T1100 pcl, 1.0
drv:///sample.drv/deskjet.ppd HP DeskJet Series
drv:///sample.drv/laserjet.ppd HP LaserJet Series PCL 4/5
lsb/usr/cupsfilters/pxlmono.ppd HP LaserJet Series PCL 6 CUPS
drv:///indexv3.drv/i4waves3.ppd Index 4-Waves PRO, 1.0
drv:///indexv3.drv/i4x4pro3.ppd Index 4x4 PRO V3, 1.0
drv:///indexv3.drv/ibasicd3.ppd Index Basic-D V3, 1.0
drv:///indexv4.drv/ibasicd4.ppd Index Basic-D V4/V5, 1.0
drv:///indexv3.drv/ibasics3.ppd Index Basic-S V3, 1.0
drv:///indexv4.drv/ibasics4.ppd Index Basic-S V4/V5, 1.0
drv:///indexv4.drv/ibrlbox4.ppd Index Braille Box V4/V5, 1.0
drv:///indexv3.drv/ieveres3.ppd Index Everest-D V3, 1.0
drv:///indexv4.drv/ieveres4.ppd Index Everest-D V4/V5, 1.0
--More--

Administration

The CUPS server can be administered on the command line by using the following commands:

Command Description
lpadmin The main administration command for adding, deleting and modifying spools
accept Allows jobs to be added to a spool
reject Disallows jobs to be added to a spool
cupsenable Allows jobs in a spool to be processed
cupsdisable Disallows jobs in a spool to be processed
lpstat Lists the queud jobs
cancel Deletes jobs
lpmove Moves jobs from one spool to another
lpinfo Lists the filters, backends and printers
lppasswd Administers accounts specific to CUPS

The lpstat Command

The lpstat command is used too view the list of spools:

[root@centos8 ~]# lpstat -t
scheduler is running
no system default destination
lpstat: No destinations added.
lpstat: No destinations added.
lpstat: No destinations added.
lpstat: No destinations added.

The lpadmin Command

Create a RAW printer spool as follows:

[root@centos8 ~]# lpadmin -p pri1 -v socket://localhost:12000 -m raw

The switches used here are as follows:

Switch Description
-p The spool name
-v The printer represented as an URL
-m The model to use or the driver

The URLs can be of the follwoing types:

URL Description
file:/path/filename Print to a file
http://server:631/ipp/port1 Print via HTTP
lpd://server/queue Print via LPD
ipp://server:631/printers/queue Print via IPP
smb://workgroup/serveur/nompartage Print via SMB
socket://server Print via JetDirect
serial:/dev/ttyS0?baud=1200+bits=8+parity=none+flow=none Print via a serial port
parallel:/dev/lp0 Print via a parallel port

Now check that the spool has been created :

[root@centos8 ~]# lpstat -t
scheduler is running
no system default destination
device for pri1: socket://localhost:12000
pri1 not accepting requests since Thu 03 Jun 2021 02:10:02 PM EDT -
	reason unknown
printer pri1 disabled since Thu 03 Jun 2021 02:10:02 PM EDT -
	reason unknown

The accept and cupsenable Commands

It is now possible to use the accept and cupsenable commands to activate the print spool:

[root@centos8 ~]# accept pri1
[root@centos8 ~]# lpstat -t
scheduler is running
no system default destination
device for pri1: socket://localhost:12000
pri1 accepting requests since Thu 03 Jun 2021 02:10:02 PM EDT
printer pri1 disabled since Thu 03 Jun 2021 02:10:02 PM EDT -
	reason unknown
[root@centos8 ~]# cupsenable pri1
[root@centos8 ~]# lpstat -t
scheduler is running
no system default destination
device for pri1: socket://localhost:12000
pri1 accepting requests since Thu 03 Jun 2021 02:11:17 PM EDT
printer pri1 is idle.  enabled since Thu 03 Jun 2021 02:11:17 PM EDT

Important : Note that accept and cupsenable have their opposites : reject and cupsdisable.

The -d option of the lpadmin command can be used to define a spool as the default destination:

[root@centos8 ~]# lpadmin -d pri1
[root@centos8 ~]# lpstat -t
scheduler is running
system default destination: pri1
device for pri1: socket://localhost:12000
pri1 accepting requests since Thu 03 Jun 2021 02:11:17 PM EDT
printer pri1 is idle.  enabled since Thu 03 Jun 2021 02:11:17 PM EDT

Now create a spool for an HP Color LaserJet Series PCL 6 using the pxlcolor.ppd file:

[root@centos8 ~]# lpadmin -p Printer1 -E -v parallel:/dev/lp0 -m pxlcolor.ppd
[root@centos8 ~]# lpstat -t
scheduler is running
system default destination: pri1
device for pri1: socket://localhost:12000
device for Printer1: parallel:/dev/lp0
pri1 accepting requests since Thu 03 Jun 2021 02:11:17 PM EDT
Printer1 accepting requests since Thu 03 Jun 2021 02:17:25 PM EDT
printer pri1 is idle.  enabled since Thu 03 Jun 2021 02:11:17 PM EDT
printer Printer1 is idle.  enabled since Thu 03 Jun 2021 02:17:25 PM EDT

Important : Note that the -E switch combines accept and cupsenable.

The file for this spool already exists:

[root@centos8 ~]# ls -l /dev/lp0
crw-rw----. 1 root lp 6, 0 Jun  3 14:02 /dev/lp0

Now test this new printer:

[root@centos8 ~]# echo "Test Printer File" > /tmp/test.print
[root@centos8 ~]# lpadmin -d Printer1
[root@centos8 ~]# lpstat -t
scheduler is running
system default destination: Printer1
device for pri1: socket://localhost:12000
device for Printer1: parallel:/dev/lp0
pri1 accepting requests since Thu 03 Jun 2021 02:11:17 PM EDT
Printer1 accepting requests since Thu 03 Jun 2021 02:17:25 PM EDT
printer pri1 is idle.  enabled since Thu 03 Jun 2021 02:11:17 PM EDT
printer Printer1 is idle.  enabled since Thu 03 Jun 2021 02:17:25 PM EDT

[root@centos8 ~]# lp /tmp/test.print
request id is Printer1-1 (1 file(s))

Important : Note that the job is called Printer1-1.

Now create a second spool for an HP Color LaserJet Series PCL 6 using the pxlcolor.ppd file:

[root@centos8 ~]# lpstat -t
scheduler is running
system default destination: Printer1
device for pri1: socket://localhost:12000
device for Printer1: parallel:/dev/lp0
device for Printer2: parallel:/dev/lp1
pri1 accepting requests since Thu 03 Jun 2021 02:11:17 PM EDT
Printer1 accepting requests since Thu 03 Jun 2021 02:23:03 PM EDT
Printer2 accepting requests since Thu 03 Jun 2021 02:23:46 PM EDT
printer pri1 is idle.  enabled since Thu 03 Jun 2021 02:11:17 PM EDT
printer Printer1 now printing Printer1-1.  enabled since Thu 03 Jun 2021 02:23:03 PM EDT
	Printer not connected; will retry in 30 seconds.
printer Printer2 is idle.  enabled since Thu 03 Jun 2021 02:23:46 PM EDT
Printer1-1           root              1024   Thu 03 Jun 2021 02:23:03 PM EDT

Classes

A class is a group of identical printers. Jobs sent to a class are printed on the first available member printer.

To create a class, use the lpadmin command as follows:

[root@centos8 ~]# lpadmin -p Printer1 -c class1
[root@centos8 ~]# lpadmin -p Printer2 -c class1

Check that the class has been created:

[root@centos8 ~]# lpstat -t
scheduler is running
system default destination: Printer1
members of class class1:
	Printer1
	Printer2
device for class1: ///dev/null
device for pri1: socket://localhost:12000
device for Printer1: parallel:/dev/lp0
device for Printer2: parallel:/dev/lp1
class1 not accepting requests since Thu 03 Jun 2021 02:24:25 PM EDT -
	reason unknown
pri1 accepting requests since Thu 03 Jun 2021 02:11:17 PM EDT
Printer1 accepting requests since Thu 03 Jun 2021 02:23:03 PM EDT
Printer2 accepting requests since Thu 03 Jun 2021 02:23:46 PM EDT
printer class1 disabled since Thu 03 Jun 2021 02:24:25 PM EDT -
	reason unknown
printer pri1 is idle.  enabled since Thu 03 Jun 2021 02:11:17 PM EDT
printer Printer1 now printing Printer1-1.  enabled since Thu 03 Jun 2021 02:23:03 PM EDT
	Printer not connected; will retry in 30 seconds.
printer Printer2 is idle.  enabled since Thu 03 Jun 2021 02:23:46 PM EDT
Printer1-1           root              1024   Thu 03 Jun 2021 02:23:03 PM EDT

Important : CUPS can also create Implicit Classes automatically. These work just like normal classes but are created automatically as function of what printers and other classes have been configured. Note that classes can also contain other classes.

The /etc/cups/printers.conf File

The configuration of each printer for which a spool has been declared under cups can be found in the /etc/cups/printers.conf file:

[root@centos8 ~]# cat /etc/cups/printers.conf
# Printer configuration file for CUPS v2.2.6
# Written by cupsd on 2021-06-03 14:24
# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING
<Printer pri1>
UUID urn:uuid:2af2862a-9a4d-3095-59d5-ca108d8d9837
Info pri1
DeviceURI socket://localhost:12000
State Idle
StateTime 1622743877
ConfigTime 1622743802
Type 4
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
</Printer>
<DefaultPrinter Printer1>
UUID urn:uuid:ea6f22ce-ee8f-3447-4e09-f8659ccfe929
Info Printer1
MakeModel HP Color LaserJet Series PCL 6 CUPS
DeviceURI parallel:/dev/lp0
State Idle
StateTime 1622744583
ConfigTime 1622744245
Type 8400972
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
</DefaultPrinter>
<Printer Printer2>
UUID urn:uuid:1f7e7401-6bc4-306a-50ef-b07f2c78bf65
Info Printer2
MakeModel HP Color LaserJet Series PCL 6 CUPS
DeviceURI parallel:/dev/lp1
State Idle
StateTime 1622744626
ConfigTime 1622744626
Type 8400972
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
</Printer>

The /etc/cups/classes.conf File

The configuration of each class for which a spool has been declared under cups can be found in the /etc/cups/classes.conf file:

[root@centos8 ~]# cat /etc/cups/classes.conf
# Class configuration file for CUPS v2.2.6
# Written by cupsd on 2021-06-03 14:24
# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING
<Class class1>
UUID urn:uuid:989a4f91-8d00-30f1-7322-63fbacfefb7f
Info class1
State Stopped
StateTime 1622744665
Accepting No
Shared Yes
JobSheets none none
Printer Printer1
Printer Printer2
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy retry-current-job
</Class>

The cancel Command

The cancel command is used to delete a job:

[root@centos8 ~]# lpstat
Printer1-1           root              1024   Thu 03 Jun 2021 02:23:03 PM EDT
[root@centos8 ~]# cancel Printer1-1
[root@centos8 ~]# lpstat
[root@centos8 ~]#

The lpmove Command

The lpmove command is used to move the entire spool content from one spool to another:

Define pri1 as the default printer:

[root@centos8 ~]# lpadmin -d pri1

Create a new print job:

[root@centos8 ~]# lp /tmp/test.print
request id is pri1-2 (1 file(s))
[root@centos8 ~]# lpstat
pri1-2                  root              1024   Thu 03 Jun 2021 02:29:29 PM EDT

Move the contents of the pri1 spool to class1:

[root@centos8 ~]# lpmove pri1 class1
[root@centos8 ~]# lpstat
class1-2               root              1024   Thu 03 Jun 2021 02:29:29 PM EDT

The removal of a spool from a class requires the use of the lpadmin:

[root@centos8 ~]# lpadmin -p Printer1 -r class1
[root@centos8 ~]# lpadmin -p Printer2 -r class1
[root@centos8 ~]# lpstat -t
scheduler is running
system default destination: pri1
device for pri1: socket://localhost:12000
device for Printer1: parallel:/dev/lp0
device for Printer2: parallel:/dev/lp1
pri1 accepting requests since Thu 03 Jun 2021 02:30:23 PM EDT
Printer1 accepting requests since Thu 03 Jun 2021 02:28:33 PM EDT
Printer2 accepting requests since Thu 03 Jun 2021 02:23:46 PM EDT
printer pri1 is idle.  enabled since Thu 03 Jun 2021 02:30:23 PM EDT
printer Printer1 is idle.  enabled since Thu 03 Jun 2021 02:28:33 PM EDT
printer Printer2 is idle.  enabled since Thu 03 Jun 2021 02:23:46 PM EDT

Important : Note that the class is automatically destroyed when the last spool is removed from it.

To destroy the previously created spools, the lpadmin command can be used with the x option:

[root@centos8 ~]# lpadmin -x Printer1
[root@centos8 ~]# lpadmin -x Printer2
[root@centos8 ~]# lpadmin -x pri1
[root@centos8 ~]# lpstat -t
scheduler is running
no system default destination
lpstat: No destinations added.
lpstat: No destinations added.
lpstat: No destinations added.
lpstat: No destinations added.

Web Interface

CUPS can be entirely configured by using a web interface available at the following address: http://localhost:631 or https://localhost:631.


<html> <div align=“center”> Copyright © 2021 Hugh Norris. </html>

Menu