Article

penguin_roar's picture
article
Reads:

4454

Score:
0
0
 
Comments:

0

Simple Watchdog for iPrint

Author Info

29 April 2009 - 2:38pm
Submitted by: penguin_roar

(View Disclaimer)

This script uses curl to download the http://servername/ipp page, and then uses that to decide whether ipp is running as it should or not, with a simple if statement to see if the page contains any html code.

The reason we need to pick a particular printers page is that it's possible to get at the page in some instances, but not at any of the printers.

The restarts are logged to /var/log/messages with the time and date of the restart.

Save this script as /usr/bin/ipp-dog and edit /etc/crontab and add the line below. It's possible to have it run more often, but as this happens rarely for us it's not a matter of seconds if things clear up by itself. Just as long as it gets fixed in a timely manner. This line makes the watchdog look at the service each 5 minutes.

I know it's a very crude script but it works and is an order of magnitudes easier than fail over.

*/5 * * * *  root   /usr/bin/ipp-dog
/usr/bin/ipp-dog 
------>8----------- 
#!/bin/bash
curl http://yourserverdnsnamehere/ipp/someprinter > /tmp/ipptest 
COUNT=`grep PCLXL /tmp/ipptest | wc -l`
if [ $COUNT = 0 ]
then
echo "Iprint  is restarting at  `date`" >> /var/log/messages
/etc/init.d/novell-ipsmd restart
else
echo "Iprint is running." >> /var/log/messages
fi
------>8------------


Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

© 2013 Novell