[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

FW: UPS question about /etc/rc0.d/S90halt and /etc/init.d/ups-mon itor (woody)



I have an APC Smart-UPS and run apcupsd 3.8.5 and I have a question about
the woody shutdown sequence. 

The last step in a change to run level 0 calls S90halt:

==> /etc/rc0.d/S90halt <==
#! /bin/sh
#
# halt		Execute the halt command.
#
# Version:      @(#)halt  2.84-2  07-Jan-2002  miquels@cistron.nl
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin

# See if we need to cut the power.
if [ -x /etc/init.d/ups-monitor ]
then
	/etc/init.d/ups-monitor poweroff
fi

# Don't shut down drives if we're using RAID.
hddown="-h"
if grep -qs '^md.*active' /proc/mdstat
then
	hddown=""
fi

halt -d -f -i -p $hddown

: exit 0
=== eof ===

So the first thing S90halt does is to call /etc/init.d/ups-monitor (which is
provided by apcupsd):

==> /etc/init.d/ups-monitor <==
#!/bin/sh
# apcupsd halt script
# by Martin Mitchell <martin@debian.org>
# modifications by Gordon Morehouse <spambox@evernex.com> April 2001

case "$1" in
	poweroff | killpower)
	if [ -f /etc/apcupsd/powerfail ]; then
		echo ""
		echo -n "apcupsd: Ordering UPS to kill power... "
		/etc/apcupsd/apccontrol killpower
		echo "done."	
		echo ""
		echo "Please ensure the UPS has powered off before
rebooting."
		echo "Otherwise, the UPS may cut the power during the
reboot!"
		echo ""
		sleep 2d
	fi
	;;

	*)
	;;
esac

exit 0
=== eof ===

My concern is that if there was a power failure, then the file
/etc/apcupsd/powerfail would exist causing ups-monitor to call
/etc/apcupsd/apccontrol killpower.  The ups-monitor script would then sleep
for 2 days.  This will prevent the rest of S90halt from running.  Therefore
the final halt command would never be run.

I realise that the system would be turned off after the "shutdown grace
delay" in the ups but wouldn't it be nicer to the system if the "halt .. -p"
command at the end of S90halt was run so that the PC powers itself off
rather than suffer a power failure?

Cheers,
Roland.
--
Tell me and I'll forget, show me and I may remember,
involve me and I'll understand - Chinese Proverb.



Reply to: