Koozali.org: home of the SME Server

Obsolete Releases => SME Server 9.x => Topic started by: Jáder on November 23, 2020, 09:39:52 PM

Title: how to disable printer queue [SOLVED]
Post by: Jáder on November 23, 2020, 09:39:52 PM
I´ve sent a printer to maintenance and would like to disable anyone to send to that queue without delete queue.
I´ve found several pages about enable/disable command but no binary available on /usr/bin as indicated.

Can this be done? How ?

Regards,
Jáder
Title: Re: how to disable printer queue
Post by: mmccarn on November 24, 2020, 02:28:46 PM
I can't find any info on how to disable a printer.

If your printer was added using the 'Printers' section of server-manager and you don't have CUPS installed, the easiest solution may be to save the settings and delete them, then re-create them later.

Here are some commands that will:
* copy the current printer settings to an invalid entry in the accounts db
* delete the printer (remove it from /etc/printcap)
Code: [Select]
# assuming your printer name is "hp"...
export PRINTER=hp
db accounts set $PRINTER $(db accounts get $PRINTER |tr "|" " " |sed 's/printer/printer-save/')
signal-event printer-delete

And here are some commands to
* restore the saved settings
* re-create the printer (add it back to /etc/printcap)
Code: [Select]
export PRINTER=hp
db accounts set $PRINTER $(db accounts get $PRINTER |tr "|" " " |sed 's/printer-save/printer/')
signal-event printer-create

Here is what my 'hp' entry looks like during this process...
Code: [Select]
# db accounts show hp
hp=printer
    Address=192.168.200.19
    Description=hp
    Location=remote
    RemoteName=raw

# export PRINTER=hp
# db accounts set $PRINTER $(db accounts get $PRINTER |tr "|" " " |sed 's/printer/printer-save/')

# db accounts show hp
hp=printer-save
    Address=192.168.200.19
    Description=hp
    Location=remote
    RemoteName=raw

# export PRINTER=hp
# db accounts set $PRINTER $(db accounts get $PRINTER |tr "|" " " |sed 's/printer-save/printer/')

# db accounts show hp
hp=printer
    Address=192.168.200.19
    Description=hp
    Location=remote
    RemoteName=raw

Note: this process will misbehave if there are spaces in your printer 'Description' or any of the other values...
Title: Re: how to disable printer queue
Post by: Jáder on November 24, 2020, 02:34:28 PM
I´ve found this page https://www.cyberciti.biz/faq/linux-how-to-start-and-stop-printer-queues/  showing the command ENABLE and DISABLE but say nothing about to use LPd or CUPS.

Anyways, I´ll let it as is because it´s too risky destroy/recreate the printer: I´m 4000Km away from location.

I´d prefer a switch on web interface to disable it temporarly from accept jobs. Right now I´ll clean it up once a day.

Regards.
Title: Re: how to disable printer queue
Post by: Jáder on November 24, 2020, 02:38:47 PM
AND offcourse, just a minute later, I found out in GOOGLE:

[root@andorinha ~]# lpc -Px476dw stop
 Printer: x476dw@andorinha
 x476dw@andorinha.antinsect.com.br: stopped

[root@andorinha ~]# lpc -Px476dw disable
 Printer: x476dw@andorinha
 x476dw@andorinha.antinsect.com.br: disabled

[root@andorinha ~]# lpc -Px476dw status
 Printer           Printing Spooling Jobs  Server Subserver Redirect Status/(Debug)
 x476dw@andorinha   disabled disabled    0    none    none


DISABLE avoid to anyone to put jobs on queue, STOP  just avoid print jobs to be printed.
I´ll use DISABLE and create an alias disable-printer / script to be easy to use!
Title: Re: how to disable printer queue [SOLVED]
Post by: TerryF on November 25, 2020, 01:03:08 AM
Like it - definetly wiki info..nice

Added - The contrib https://wiki.contribs.org/LPRng_print_queue_monitor also offers the abilty to disable the queue for a selected printer