Diffstat (limited to 'sbin/rc.0')
1 files changed, 83 insertions, 0 deletions
diff --git a/sbin/rc.0 b/sbin/rc.0
new file mode 100755
@@ -0,0 +1,83 @@
+# rc.6 This file is executed by init when it goes into runlevel
+# 0 (halt) or runlevel 6 (reboot). It kills all processes,
+# unmounts file systems and then either halts or reboots.
+# Version: @(#)/etc/rc.d/rc.6 1.50 1994-01-15
+# Author: Miquel van Smoorenburg <firstname.lastname@example.org>
+# Modified by: Patrick J. Volkerding, <email@example.com>
+# Set the path.
+# If there are SystemV init scripts for this runlevel, run them.
+if [ -x /sbin/init.d/sysvinit ]; then
+ /sbin/init.d/sysvinit start
+# Set linefeed mode to avoid staircase effect.
+echo "Running shutdown script $0:"
+# Find out how we were called.
+case "$0" in
+ echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
+ exit 1
+# Kill all processes.
+# INIT is supposed to handle this entirely now, but this didn't always
+# work correctly without this second pass at killing off the processes.
+# Since INIT already notified the user that processes were being killed,
+# we'll avoid echoing this info this time around.
+if [ "$1" != "fast" ]; then # shutdown did not already kill all processes
+ killall5 -15
+ sleep 5
+ killall5 -9
+# Before unmounting file systems write a reboot or halt record to wtmp.
+# Syncing data
+# Unmount any remote filesystems:
+echo "Unmounting remote filesystems."
+umount -na -tnfs
+# Turn off swap, then unmount local file systems.
+echo "Turning off swap."
+echo "Unmounting local file systems."
+# Don't remount UMSDOS root volumes:
+if [ ! "`cat /proc/mounts | head -1 | cut -d ' ' -f 5`" = "umsdos" ]; then
+ umount -na -t nonfs -t noproc
+ echo "Remounting root filesystem read-only."
+ mount -n -o remount,ro /
+ umount -na -t nonfs -t noumsdos -t noproc
+# This never hurts:
+# Now halt (poweroff with APM kernels) or reboot.
+if [ "$command" = "reboot" ]; then
+ echo "Rebooting."
+ reboot -f
+ halt -f -p