home *** CD-ROM | disk | FTP | other *** search
- . /etc/init.d/functions
-
- echo
- echo $0
- echo
-
- echo "Sending all processes, not being run by init, the TERM signal"
- /sbin/killall5 -15
- sleep 5
- echo "Okay, last call...sending all processes, not being run by the, the KILL signal"
- /sbin/killall5 -9
-
- if [ -e /etc/watchboot ]; then
- W="y"
- echo "Press Enter to continue"
- read -t 15 -s -n 1 A
- fi
-
- rm -f /etc/watchboot
-
- if [ "x$W" = "xy" ]; then
- echo "Showing /etc/watchboot"
- ls -l /etc/watchboot
- echo "Press Enter to continue"
- read -t 15 -s -n 1 A
- fi
-
-
- echo "Unmounting all non-system mounts"
- remaining=`cat /proc/mounts | awk '!/( \/dev | \/proc | \/ )/ { print $2 }'`
- for i in "$remaining"; do
- echo "umounting $i"
- umount $i
- done
-
- if [ "x$W" = "xy" ]; then
- echo "Press Enter to continue"
- read -t 15 -s -n 1 A
- fi
-
- echo "Using halt -w to write record to /var/log/wtmp"
- halt -w
-
-
-
- #This remounts the root directory as read-only
- #For the future: This should also check if /etc has it's own mount
- # and remount it read-only
- mount -n -o remount,ro /
- if [ $? -ne 0 ]; then
- echo "Trying to mount / read-only again"
- /sbin/killall5 -9
- sleep 5
- mount -n -o remount,ro /
- fi
-
- if [ "x$W" = "xy" ]; then
- ps -ef
- mount
- echo "Press Enter to continue"
- read -t 15 -s -n 1 A
- fi
-
-
- #Sync the file system
- sync;sync;sync
-
- if [ "x$W" = "xy" ]; then
- echo "Press Enter to continue"
- read -t 15 -s -n 1 A
- fi
-
- case "$0" in
- *halt)
- echo "System is stopped. You may turn off the power."
- ;;
- *reboot)
- echo "System is rebooting..."
- reboot -i -d
- ;;
- *)
- echo "System is stopped. You may turn off the power."
- ;;
- esac
-
-
-