#!/bin/sh umask 022 . /etc/rc.conf case "$1" in reboot|poweroff) ;; *) echo "Invalid action '$1' for rc.shutdown" >&2 exit 1 ;; esac # avoid staircase effect by setting linefeed mode echo; /bin/stty onlcr echo Shutting down echo Saving system clock [ -n "$TIMEZONE" ] && export TZ="$TIMEZONE" /bin/hwclock -w -u /dev/rtc0 unset TZ /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null echo Sending TERM to all processes /bin/killall5 -s TERM /bin/sleep 3 echo Sending KILL to all processes /bin/killall5 -s KILL echo Remounting root as read-only /bin/mount -o remount,ro / echo Unmounting filesystems /bin/umount -a /bin/sync /bin/sleep 3 wait echo Good bye. case "$1" in reboot) /bin/halt -r ;; poweroff) /bin/halt -p ;; esac