[Pkg-sysvinit-devel] Bug#539260: sysvinit: rc.local doesn't stop when system is rebooted

Nigel Horne njh at bandsman.co.uk
Thu Jul 30 08:01:45 UTC 2009


Package: sysvinit
Version: 2.87dsf-2
Severity: wishlist

/etc/init.d/rc.local doesn't stop /etc/rc.local when the system is shutdown
or rebooted, so local services may not be cleanly stopped.

Here is a suggested new /etc/init.d/rc.local:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          rc.local
# Required-Start:    $remote_fs $syslog
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Run /etc/rc.local if it exist
### END INIT INFO


PATH=/sbin:/usr/sbin:/bin:/usr/bin

. /lib/init/vars.sh
. /lib/lsb/init-functions

do_start() {
	if [ -x /etc/rc.local ]; then
	        [ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
		/etc/rc.local start
		ES=$?
		[ "$VERBOSE" != no ] && log_end_msg $ES
		return $ES
	fi
}

do_stop() {
	if [ -x /etc/rc.local ]; then
	        [ "$VERBOSE" != no ] && log_begin_msg "Stopping local boot scripts (/etc/rc.local)"
		/etc/rc.local stop
		ES=$?
		[ "$VERBOSE" != no ] && log_end_msg $ES
		return $ES
	fi
}

case "$1" in
    start)
	do_start
        ;;
    restart|reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;
    stop)
	do_stop
        ;;
    *)
        echo "Usage: $0 start|stop" >&2
        exit 3
        ;;
esac


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages sysvinit depends on:
ii  initscripts                   2.87dsf-2  scripts for initializing and shutt
ii  libc6                         2.9-23     GNU C Library: Shared libraries
ii  libselinux1                   2.0.82-1   SELinux shared libraries
ii  libsepol1                     2.0.36-1   Security Enhanced Linux policy lib
ii  sysv-rc                       2.87dsf-2  System-V-like runlevel change mech
ii  sysvinit-utils                2.87dsf-2  System-V-like utilities

sysvinit recommends no packages.

sysvinit suggests no packages.

-- no debconf information





More information about the Pkg-sysvinit-devel mailing list