Porting initscripts from SuSE to Ubuntu

July 2009


In SuSE initscripts,

$START_DAEMON $START_DAEMON_FLAG $DAEMON_USER $DAEMON -d
    

may be called. Without porting effort, this will fail on Ubuntu unless lsb is installed.

Even then it will still fail, because inside the lsb function start_daemon sourced from /lib/lsb/init-functions, there is the statement

exec="$1"; shift
<snip>
/sbin/start-stop-daemon --start --nicelevel $nice --quiet --exec $exec --oknodo --pidfile "$pidfile" -- "$@"
    

so --exec $exec becomes --exec $START_DAEMON_FLAG while it would need to be $DAEMON (full path).

Simplest solution is to replace the indirection via lsb with a start-stop-daemon line proper.