I'm attempting to set up print quotas for printers here at the office. However, it appears when the quota is reached, the print just fails silently, and the user doesn't have any idea what's happening.

The page quota's been set up by altering the PageLimit directive in /etc/cups/printers.conf

It appears I'm getting the message

E [04/Mar/2013:15:34:28 -0700] Returning IPP client-error-not-possible for Create-Job
(ipp://localhost:631/printers/Hewlett-Packard-HP-LaserJet-4100-MFP) from localhost

in my log at /var/log/cups/error_log.

I tried hacking something together via a command like

tail -f /var/log/cups/error_log | grep 'client-error-not-possible for Create-Job' | DISPLAY=:0 notify-send -t 30000 -i 'notification-message-email' 'Printing Quota reached for this Printer'

But that doesn't seem to really work as it only displays the message once on the first error message.

Any thoughts or solutions? It really seems like there should be a prebaked solution for this.

1 Answer 1


Answered here on Super User by Semafoor:

I would look into using incrontab for monitoring changes to the file system, and combine that with the little script you already have.

This looks approximately as follows. First, save the script that you want to execute as a file, e.g. as cups_monitor.sh in /usr/local/bin (don't forget to make it executable).

VAR=`tail -n 1 /var/log/cups/error_log | grep 'client-error-not-possible for Create-Job'`
if [[ -n "$VAR" ]]; then
   echo "$VAR" | DISPLAY=:0 notify-send -t 30000 -i

You might want to check this. My scripts are never right first try :). Also note that it is possible that this script does not capture your error message if it is followed by other message: I only look at the last line of the log file (-n 1); this should be easy to change.

Then edit your incrontab

incrontab -e

by adding the line

/var/log/cups/error_log IN_CLOSE_WRITE /usr/local/bin/cups_monitor.sh

The IN_CLOSE_WRITE is called an 'event symbol' and indicates that you want to want to call your script when/var/log/cups/error_log was closed after it was opened for writing; you can find other events in the man page of incrontab.

Keep in mind that I did not test this. You can see whether the incrontab file was changed successfully and whether it calls your script or not by looking in the syslog (tail /var/log/syslog).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.