Archive for January, 2008

Simple service watchdog

Posted on the January 15th, 2008 under IT, Linux by Konrad Żak

Recently I got some trouble with saslauthd unexpectly dying. Despite strong will to discover cause of problems I needed badly some kind of watchdog bringing dead service back to life. Yes, there is still inittab respawn at your disposal, but it has some major drawbacks.

Consider this simple shell script:

#!/bin/sh
# give the $4 service $1 seconds to start
sleep $1
# then every $2 seconds check if it's running by looking
# for $3 string in the list of processes...
# and if it's not running restart the $4 service
while true; do if [[ ! `ps -efw |grep -v grep |grep -v $0 |grep $3|awk '{print $2}'` ]]; then service $4 restart > /dev/null 2>&1;fi;sleep $2;done

It’s expected to run from /etc/rc.local like that:

/usr/local/bin/watchdog 60 60 saslauthd saslauthd&

Undefined class constant ‘UPLOADS_URI_SUFFIX’

Posted on the January 14th, 2008 under IT, Web development, Zend Framework by Konrad Żak

While trying to receive list of YouTube user’s videos list with Zend Framework 1.0.3 you can get Undefined class constant ‘UPLOADS_URI_SUFFIX’ PHP error. Constant name appear to be incorrectly spelled as UPLAODS_URI_SUFFIX on the 91st line of Zend/Gdata/YouTube.php. It’s easy to fix, this line should look like:

const UPLOADS_URI_SUFFIX = 'uploads';

Later on I found this bug already reported more than month ago:
http://framework.zend.com/issues/browse/ZF-2250

Hope this help, regards.