#!/bin/bash # # MBProbe_critical.sh # # AUTHOR: # Dan Harkless http://harkless.org/dan/software/ # # COPYRIGHT: # This file is Copyright (C) 2005 by Dan Harkless, and is released under the # GNU General Public License . # # DESCRIPTION: # A shell script to be called from MBProbe # when measurements go into the Critical zone. Quickly and unceremoniously # shuts down the machine. # # MBProbe has a builtin Shutdown feature, but on most machines it only shuts # down to the "It is now safe to shutdown your computer" screen rather than # powering off. Note that if you set "On Critical" to "Do nothing", this # script will not be called (up through MBProbe 1.31 Beta 9, at least), even # if you have a check box by Critical's "Execute Program". If you set "On # Critical" to Shutdown, the incomplete shutdown will generally finish before # this script finishes doing a complete one. Therefore, you must use the # "Suspend" setting, which luckily fails to actually suspend most machines, # and this script will be successfully called. # # This script requires Cygwin . You must # associate the .sh extension with the bash.exe or sh.exe executables, and of # course have your :\cygwin\bin directory in the system's PATH (for the # necessary DLL(s)). After you do associate it, be careful not to double- # click on this file, or you will, of course, shut down your machine. If you # do the associating using Open With in Windows Explorer, the same thing will # happen (you may find this a useful confirmation that the script works, but # be prepared for it). # # DATE MODIFICATION # ========== ================================================================== # 2005-09-27 As of Cygwin shutdown 1.7-1 (2005-04-23), we need to use -x (which # uses ExitWindowsEx() rather than InitiateSystemShutdown()) on # Windows 2000 to power all the way down rather than just going to # the "It is now safe..." screen. For more info, see # www.mail-archive.com/cygwin-announce@cygwin.com/msg01150.html. # 2002-12-14 On current version of Cygwin, need to set PATH explicitly. # 2002-08-19 Original. export PATH=/usr/sbin:/usr/bin shutdown -f -s -x now