UPS: apcupsd clean sources
[tomato.git] / release / src / router / apcupsd / platforms / hpux / halt.in
blob58489d28b87c91bb0374046cbd62e50fc3ec2c30
1 #! /bin/sh
2 # Copyright (c) 1996 S.u.S.E. GmbH Fuerth, Germany. All rights reserved.
4 # Author: Florian La Roche <florian@suse.de>, 1996
5 # Werner Fink <werner@suse.de>, 1996
7 # Updated for "apcupsd"
8 # Andre M. Hedrick <hedrick@astro.dyer.vanderbilt.edu>, 1997
10 # /sbin/init.d/halt (and symlinked to reboot)
13 . /etc/rc.config
15 case "$0" in
16 *halt)
17 message="The system is halted."
18 command="halt"
20 *reboot)
21 message="Please stand by while rebooting the system..."
22 command="reboot"
25 echo "$0: call me as \"halt\" or \"reboot\" please!"
26 exit 1
28 esac
30 # Write to wtmp file before unmounting /var
31 $command -w
33 echo "Sending all processes the TERM signal..."
34 killall5 -15
36 if [ "$1" = "fast" ]; then
37 sleep 1
38 else
39 sleep 5
42 echo "Sending all processes the KILL signal..."
43 killall5 -9
45 echo "Turning off swap."
46 sync ; sync
47 swapoff -a
49 echo "Unmounting file systems"
50 umount -av
52 # maybe we use Multiple devices
53 if test -f /etc/mdtab -a -x /sbin/mdadd ; then
54 echo -n "Disable Multiple Devices"
55 /sbin/mdstop -a
56 echo "."
59 # See if this is a powerfail situation.
60 if [ -f @PWRFAILDIR@/powerfail ]; then
61 echo
62 echo "Apcupsd will now power off the UPS!"
63 echo
64 @sysconfdir@/apccontrol killpower
65 echo
68 # on umsdos fs this would lead to an error message. so direct errors to
69 # /dev/null
70 mount -no remount,ro / 2> /dev/null
71 sync
73 echo $message
74 exec $command -d -f