According to LSBInitScripts:
$remote_fs all filesystems are mounted. In some LSB run-time environments,
filesystems such as /usr may be remote. If the script need a mounted
/usr/, it needs to depend on $remote_fs. Scripts depending on $remote_fs
do not need to depend on $local_fs. During shutdown, scripts that need to
run before sendsigs kills all processes should depend on $remote_fs.
while according to remote-filesystems man page:
When it occurs, local filesystems such as /usr may not be mounted.
For most normal services the filesystem(7) event is sufficient.
You should change remote-filesystems with filesystem event that:
The filesystem event is generated by the mountall(8) daemon after it
has mounted all filesystems listed in fstab(5).
SystemV init script check
$SLAPD_CONF. If is not present any type of configuration, script fail to start, and stop terminates with exit 0 without doing anything.
This check are useful in case of rebooting between the installation phase and the configuration phase or during uninstall procedure. To understand its meaning you should analyze
postrm scripts in
prerm attempts to stop
slapd, and if it fails than unistall procedure will fail too. stop procedure without configuration file will returns 0 to allow uninstall
OpenLDAP package that is installed but not configured.
check_for_no_start() prevent start execution based on $SLAPD_NO_START variable or if $SLAPD_SENTINEL_FILE file exists. This is a simple way for temporarily disabling startup of
slapd, for examples for maintenance. Even if server reboot,
slapd will not start.
SystemV script create
$piddir (if doesn't exist) and gives right permission to
$SLAPD_PIDFILE, this is necessary because
slapd will write pid in
You should add this in
According to start-stop-daemon man page:
-S, --start [--] arguments
Check for the existence of a specified process. If such a
process exists, start-stop-daemon does nothing, and exits with
error status 1 (0 if --oknodo is specified). If such a process
does not exist, it starts an instance, using either the
executable specified by --exec or, if specified, by --startas.
Any arguments given after -- on the command line are passed
unmodified to the program being started.
This is why you should remove
-- in slapd command as CameronNemo said.
Finally on stop there is option
--retry TERM/10 that means:
schedule is a list of at least two items separated by slashes
(/); each item may be -signal-number or [-]signal-name, which
means to send that signal, or timeout, which means to wait that
many seconds for processes to exit, or forever, which means to
repeat the rest of the schedule forever if necessary.
I guess that OpendLDAP need a bit of time to shutdown, so you should add the stanza
kill timeout 10, which will wait 10 seconds (vs. the default 5) to send