#! /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-@@YEAR@@ 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 case "$pgm" in *halt) message='eisfair is going down for system halt NOW!' if [ "$POWEROFF" = "yes" ] then 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 # don't umount tmpfs, tmpfs is busy /bin/umount -a --types tmpfs # 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