#! /bin/sh #---------------------------------------------------------------------------- # /etc/init.d/halt - halt the system # /etc/init.d/reboot - reboot it # # Creation: 2001-08-07 fm # Last Update: $Id$ # # Copyright (c) 2001-2012 the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- trap "" 1 pgm=`/usr/bin/basename $0` cd / . /etc/config.d/base . /etc/init.d/functions # get kernel version case $(uname -r) in 2.6*) load='/sbin/modprobe' ;; *) load='/sbin/insmod' ;; esac case "$pgm" in *halt) message='eisfair is going down for system halt NOW!' if [ "$POWEROFF" = "yes" ] then if ! lsmod | grep '^apm ' >/dev/null then case "$POWEROFF_SMP" in yes) smp=1 ;; *) smp=0 ;; esac case "$POWEROFF_REALMODE" in yes) realmode=1 ;; *) realmode=0 ;; esac ${load} apm power_off=1 smp=$smp realmode_power_off=$realmode 2>/dev/null fi command="/sbin/poweroff" else command="/sbin/halt" fi ;; *reboot) message='eisfair is going down for system reboot NOW!' command="/sbin/reboot" ;; *) echo "$0: wrong name!" exit 1 ;; esac $command -w boot_mesg " * Sending all processes the TERM signal ..." /sbin/killall5 -15 sleep 3 evaluate_retval boot_mesg " * Sending all processes the KILL signal ..." killall5 -9 sleep 3 evaluate_retval boot_mesg " * Turning off swap ..." sync; sync swapoff -a evaluate_retval /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' boot_mesg " * $message" evaluate_retval exec $command -d -f