[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Can you check program output? (to monitor CUPS printers)
From: |
Adam Nielsen |
Subject: |
Can you check program output? (to monitor CUPS printers) |
Date: |
Wed, 27 Oct 2010 10:59:05 +1000 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20091130) |
Hi all,
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.
Unfortunately I can't see how to make monit check the output of a
command, which I need to be able to detect the current state of the
print queue. Checking a file's content is the closest test I can see,
but I'd rather not have a cronjob running all the time outputting the
print queue status to a file for monit to check.
In order to check the current printer status I need to run this command:
lpstat -p queuename
Which prints:
printer queuename is idle. enabled since Wed 27 Oct 2010 10:30:06 EST
Or:
printer queuename disabled since Wed 27 Oct 2010 10:53:31 EST -
Paused
So I would use a regex to check for the presence of the word "disabled"
and restart the queue if it is found. Does anyone know how I could
achieve this check with monit?
For completeness' sake, "cupsenable -c queuename" clears a queue and
restarts it when it has been disabled.
Any suggestions would be appreciated!
Many thanks,
Adam.
- Can you check program output? (to monitor CUPS printers),
Adam Nielsen <=