#!/bin/sh # # /etc/rc.shutdown: system shutdown script # echo "Executing rc.shutdown" # Set linefeed mode to avoid staircase effect /bin/stty onlcr echo "The system is coming down. Please wait." if [ "$PREVLEVEL" = 2 ]; then # Shutdown services /sbin/service -a stop fi # Terminate all processes /sbin/killall5 -15 /usr/bin/sleep 5 /sbin/killall5 -9 # Save random seed /bin/dd if=/dev/urandom of=/var/run/random-seed count=1 2> /dev/null # Save system clock /sbin/hwclock --systohc # Write to wtmp file before unmounting /sbin/halt -w # Turn off swap /sbin/swapoff -a # Unmount file systems /bin/umount -a -r # Power off or reboot if [ "$RUNLEVEL" = 0 ]; then /sbin/poweroff -d -f -i else /sbin/reboot -d -f -i fi # End of file