slitaz-boot-scripts rev 286

rc.functions --> rc.shutdown
author Christophe Lincoln <pankso@slitaz.org>
date Tue Mar 20 09:06:00 2012 +0100 (2012-03-20)
parents b9cd5851a5f0
children 84129ba21c66
files etc/init.d/rc.functions etc/init.d/rc.shutdown
line diff
     1.1 --- a/etc/init.d/rc.functions	Sun Mar 18 00:57:34 2012 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,28 +0,0 @@
     1.4 -#!/bin/sh
     1.5 -# /etc/init.d/rc.functions: SliTaz boot scripts functions.
     1.6 -#
     1.7 -
     1.8 -# Status functions.
     1.9 -status() {
    1.10 -	echo -en "\\033[70G[ "
    1.11 -	if [ $? = 0 ]; then
    1.12 -		echo -en "\\033[1;32mOK"
    1.13 -	else
    1.14 -		echo -en "\\033[1;31mFailed"
    1.15 -	fi
    1.16 -	echo -e "\\033[0;39m ]"
    1.17 -}
    1.18 -
    1.19 -# Check daemon with pidfile: usage check_pidfile $PIDFILE $DAEMON
    1.20 -active_pidfile()
    1.21 -{
    1.22 -	if [ ! -e $1 ]; then
    1.23 -		return 1
    1.24 -	elif grep -qs "Name:.$(basename $2)$" \
    1.25 -			/proc/$(sed 's/[^0-9]//g' < $1 | head -n 1)/status ; then
    1.26 -		return 0
    1.27 -	else
    1.28 -		rm -f $1
    1.29 -		return 2
    1.30 -	fi
    1.31 -}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/etc/init.d/rc.shutdown	Tue Mar 20 09:06:00 2012 +0100
     2.3 @@ -0,0 +1,37 @@
     2.4 +#!/bin/sh
     2.5 +# /etc/init.d/rc.shutdown - This script is used by /etc/inittab to stop
     2.6 +# all daemons and shutdown the system.
     2.7 +#
     2.8 +. /etc/init.d/rc.functions
     2.9 +. /etc/rcS.conf
    2.10 +
    2.11 +log=/var/lib/shutdown.log
    2.12 +
    2.13 +# Bold info message with uptime
    2.14 +clear && echo "System is going down for reboot or halt." > $log
    2.15 +uptime >> $log
    2.16 +
    2.17 +# Store last alsa settings.
    2.18 +if [ -x /usr/sbin/alsactl ]; then
    2.19 +	alsactl store
    2.20 +fi
    2.21 +
    2.22 +# Stop all daemons started at boot time.
    2.23 +for daemon in $RUN_DAEMONS
    2.24 +do
    2.25 +	if [ -x /etc/init.d/$daemon ]; then
    2.26 +		/etc/init.d/$daemon stop >> $log
    2.27 +	fi
    2.28 +done
    2.29 +
    2.30 +# Sync all filesystems.
    2.31 +sync
    2.32 +
    2.33 +# Swap off.
    2.34 +/sbin/swapoff -a
    2.35 +
    2.36 +# Kill all processes.
    2.37 +killall5
    2.38 +
    2.39 +# Umount filesystems.
    2.40 +/bin/umount -a -r 2>/dev/null