Submit Blog  RSS Feeds

Saturday, June 23, 2012

Mac printer pausing problem lp / cups

Recently I encountered another administrative problem regarding the Macintosh platform. My invoice printing script has been running sucesfully for quite a while, but one day the problems started: the network printer started ignoring print request that had the mentioned Mac as its origin. What's more, lp (print files command) did not raise any exceptions (return status) and yet nothing was printed.

After doing some research, it occured that the printer was marked as 'paused' (although it was printing tons of other documents). The cups server logs weren't very helpful, but it became clear, that the 'paused' status was set during a temporal printer unavailability period (busy / lack of paper / offline).

A simple solution would be checking the printer status and switching it to 'ready' in case the printer was paused. So I added the following instruction to the printing script:


1  if [ ! "$(lpstat | grep Lexmark_X363dn | grep -o enabled)" ]
2  then
3     cupsenable Lexmark_X363dn || \
4     echo "Error, printer unavailable" && exit
5  fi

The condition in line 1 is fulfilled if no printer named Lexmark_X363dn is available, or a printer exists but it is not enabled. If so we try to enable the printer or show an error message if the operation was not successful.

Well after running this script the operation was indeed not successful, cupsenable required setting the SUID bit:

~ chmod +s /usr/sbin/cupsenable

This solved the printing issues for now, but  I bet it's just a matter of time before something else stops working... Macs...

~KR

No comments:

Post a Comment

free counters