Automatically Restart AIX Printers

Automatically Restart AIX Printers

I have an issue with printers in AIX especially if the the network connection isn’t 100% reliable or if the users tend to turn the printers off frequently. One of my customers is a emergency first responder organization so they need to be up and running as close to 100% as possible and printing is an important piece of their workflow. I created this script a lot of years ago and needed to reuse it this morning for them. It simply checks all the printers for ‘DOWN’ status and restarts them. I scheduled it in cron to execute every 5 minutes and everyone is happy.

#!/usr/bin/ksh

while (enq -AW | grep DOWN | grep -v HOST)
do 
     enq -U -P `enq -AW | grep DOWN | grep -v HOST | awk {'print $1$2'} | awk 'NR>1{exit};1' | sed 's/@/:@/'`
done

Cheers