|
From: | Adam Nielsen |
Subject: | Re: Can you check program output? (to monitor CUPS printers) |
Date: | Tue, 09 Nov 2010 10:21:13 +1000 |
User-agent: | Thunderbird 2.0.0.23 (X11/20091130) |
Sorry, forgot to post a followup on this!
Occasionally we get a print job which makes CUPS break, and it takes the printer offline until the job is deleted and an admin logs in and restarts the queue. I would like monit to keep an eye on this and when it happens, clear the print queue and restart the printer automatically.I do this without monit. Run a script from cron every x minutes. If it detects an offline printer, it restarts cups and only then generates output/sends an email.
Thanks for the suggestion, this works well. For reference, this is the script I run from cron every couple of minutes:
#!/bin/sh PRINTERS=`/usr/bin/lpstat -a | cut -d ' ' -f 1` for I in $PRINTERS; do if /usr/bin/lpstat -p $I | grep -q disabled; then /usr/sbin/cupsenable -c $I echo "Re-enabled CUPS print queue $I" fi doneThe 'echo' makes cron send the e-mail whenever a print queue had to be restarted.
Cheers, Adam.
[Prev in Thread] | Current Thread | [Next in Thread] |