How can I adapt this debian init.d script to work with CentOS 5?

Solution 1:

writing from scratch could be easier, depending on how complex the script is. the issue you're running into is this line in the script:

. /lib/lsb/init-functions

which loads all the functions for debian's startup scripts. in that is a function 'log_daemon_msg' which is where your problem is at.

you could look at the init-functions file to figure out what log_daemon_msg does, and replicate on CentOS, or you could step through the Debian script and see what is actually run (probably less than 5 lines of commands)

Solution 2:

/usr/share/doc/initscripts-*/sysvinitfiles contains a template you can use as a model for modifying the existing script or creating a new one.