Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We develop a Linux application to work on different RedHat/SUSE distributions. This application (namely, daemon) is expected to be automatically run at startup so we place our startup script in /etc/init.d/ directory and create symlinks in runlevel directories (../rc.d/rc5.d/, for instance). If a user removes our application, our uninstall script removes all our stuff including symlinks. It works fine if OS doesn't provide parallel script running. If parallel running is enabled, we need another solution. For instance, in SLES 10, we have in /etc/sysconfig/boot:

# Run all scripts or rather start/stop all services
# which are independent from each other in parallel.

RUN_PARALLEL="yes"

As far as we understand, we have to register our script with insserv utility. In this case, the system analyzes a script header and creates/removes symlinks on it's own. If it's true, how to organize installation/uninstallation of our application to cover both parallel and sequential startup script running? It looks like we should behave differently when parallel running is disabled or enabled. In first case, we should care about symlinks ourselves. In second case, we should delegate it to insserv. Is this right approach? If it's true, should we analyze whether parallel running is enabled by checking /etc/sysconfig/boot? It looks unreliable because in different Linux distributionsit could be different location and different parameter.

What's the best practice for installation/uninstallation Linux application that covers both parallel and sequential system startup?

Thanks,

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

let insserv create the symlinks for you. when using insserv, you can also add dependencies to your script header so insserv knows when to start and stop your script in a special runlevel. this is necessary for sequential and parallel execution. try to be compatible to lsb. here is a short example:

# Following lines are in conformance with LSB 1.2 spec
### BEGIN INIT INFO
# Provides:            your shoort app name here
# Required-Start:      what should start before your app, e.g. network
# Required-Stop:       what should stop before your app stops
# Default-Start:       2 3 4 5
# Default-Stop:        0 1 6
# Description:         longer about 
### END INIT INFO
share|improve this answer
    
Yes, it's clear but should I analyze whether run_parallel is enabled? Or should I use insserv in both cases (parallel and sequential execution)? –  user31462 Jan 12 '10 at 12:05
    
IIRC, rpm runs insserv for you on package install. –  Tobu Jan 12 '10 at 13:21
    
use insserv for both modes. –  Christian Jan 12 '10 at 13:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.