Writing sane cross-distro sysv init scripts with lsb/init-functions, possible?


#1

I have written a system v init script for Apache Tomcat using functions
/lib/lsb/init-functions. Theoretically this same init script should work on
Ubuntu as well, provided I swap out /etc/sysconfig/tomcat for
/etc/default/tomcat

Anybody know of any potential pitfalls of this approach? I imagine it is
well-trod ground.

Does lsb/init-functions require ‘redhat-lsb’ be installed on all EL vms?
and similarly does it come by default in Debian or require an additional
package?

http://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html


#2

i think redhat-lsb is required. otherwise the its /etc/init.d/functions ,
shell functions available in /etc/init.d/functions are slightly different
from what debian/ubuntu provides. also debian uses start-stop-daemon binary
while redhat based distros uses the daemon function.

On Fri, Feb 10, 2012 at 7:00 PM, Bryan Berry bryan.berry@gmail.com wrote:

I have written a system v init script for Apache Tomcat using functions
/lib/lsb/init-functions. Theoretically this same init script should work on
Ubuntu as well, provided I swap out /etc/sysconfig/tomcat for
/etc/default/tomcat

Anybody know of any potential pitfalls of this approach? I imagine it is
well-trod ground.

Does lsb/init-functions require ‘redhat-lsb’ be installed on all EL vms?
and similarly does it come by default in Debian or require an additional
package?

http://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html


#3

Ranjib, u r right about the start command for debian, didn’t think of that

However, start_daemon is available on both. Apparently on debian it calls
start-stop-daemon

i will change my scripts to use that. thanks for the heads up

On Fri, Feb 10, 2012 at 4:18 PM, Ranjib Dey ranjibd@thoughtworks.comwrote:

i think redhat-lsb is required. otherwise the its /etc/init.d/functions ,
shell functions available in /etc/init.d/functions are slightly different
from what debian/ubuntu provides. also debian uses start-stop-daemon binary
while redhat based distros uses the daemon function.

On Fri, Feb 10, 2012 at 7:00 PM, Bryan Berry bryan.berry@gmail.comwrote:

I have written a system v init script for Apache Tomcat using functions
/lib/lsb/init-functions. Theoretically this same init script should work on
Ubuntu as well, provided I swap out /etc/sysconfig/tomcat for
/etc/default/tomcat

Anybody know of any potential pitfalls of this approach? I imagine it is
well-trod ground.

Does lsb/init-functions require ‘redhat-lsb’ be installed on all EL vms?
and similarly does it come by default in Debian or require an additional
package?

http://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html