Hardcore Linux

Anything about Ubuntu, Centos, openSuSe and Fedora

Autorefresh CUPS printers

This cron script will automatically reactive all disabled CUPS printers. In our office it’s a daily problem when a faulty start or  a minor operational problem might deactivate the  said printer/s. This scripts will help you automatically enable all disabled printer Hope this work 100% for your CUPS configuration.

Updates: fixes the LIST_PRINTERS value.(03/16/2010)

# Re-activate all paused or faulty printers
# by https://hardc0l2e.wordpress.com
LIST_PRINTERS=`lpstat -p | grep printer | grep -v enable | awk '{print $2}' | sed '/^$/d'`
if [ "x$LIST_PRINTERS" !=  "x" ]; then
  for printername in $LIST_PRINTERS; do
    echo "Activating $printername ..."
    cupsenable $printername > /dev/null
sleep 1

2 responses to “Autorefresh CUPS printers

  1. Kon February 12, 2013 at 8:33 pm

    Thank you for the Script, extremely handy!

    What would be best way to automate it to run every 30 minutes?

  2. crankywheeler May 18, 2013 at 7:02 pm

    thanks a lot for this script! resolved my printing-issue in a sweep 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: