#! /bin/sh #---------------------------------------------------------------------------- # /etc/init.d/halt - halt the system # /etc/init.d/reboot - reboot it # # Creation: 07.08.2001 fm # Last Update: 03.09.2003 fm # # Copyright (c) 2001-2003 Frank Meyer #---------------------------------------------------------------------------- trap "" 1 pgm=`/usr/bin/basename $0` cd / . /etc/config.d/base case "$pgm" in *halt) message='The system is going down for system halt NOW!' if [ "$POWEROFF" = "yes" ] then if ! lsmod | grep '^apm ' >/dev/null then insmod apm 2>/dev/null fi command="/sbin/poweroff" else command="/sbin/halt" fi ;; *reboot) message='The system is going down for system reboot NOW!' command="/sbin/reboot" ;; *) echo "$0: wrong name!" exit 1 ;; esac $command -w echo "Sending all processes the TERM signal..." /sbin/killall5 -15 sleep 3 echo "Sending all processes the KILL signal..." killall5 -9 sleep 3 echo "Turning off swap" sync; sync swapoff -a /bin/umount -a # umount all (root as read/only) /bin/mount -o remount,ro / # be sure: remount as read/only /bin/sync sleep 2 echo -e '\007' echo $message exec $command -d -f