Stephen Stuart wrote:
> I call this in /etc/rc.shutdown.local to shut all VMs down gracefully and
> wait, perhaps a variant would help you.
> 
> #!/bin/sh
> 
> INTERVAL=5
> /usr/bin/killall -TERM bhyve
> echo -n "/dev/vmm:"
> while test -d /dev/vmm ; do
>     echo -n "" $(/bin/ls /dev/vmm | /usr/bin/wc -w)
>     /bin/sleep $INTERVAL
> done
> echo " 0"

Thanks for reminding me about /etc/rc.shutdown.local. I've tested a
solution today and it seems working.

1. Start apcupsd with --term-on-powerfail
apcupsd_enable="YES"
apcupsd_flags="--term-on-powerfail"

2. Put the following line into /etc/rc.shutdown.local
test -f /var/run/powerfail && /usr/local/sbin/apcupsd --killpower

Now, when the UPS power is exhausted, apcupsd starts the shutdown
procedure and exits. The system shuts down without any haste, as it
pleases, and at the very end "apcupsd --killpower" is called and
poweroffs the UPS.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/

Attachment: signature.asc
Description: PGP signature

Reply via email to