Gerardo,

On Mon, Sep 26, 2011 at 2:02 AM, Gerardo Exequiel Pozzi
<[email protected]> wrote:
> This can be useful for run apcupsd --killpower

Rather than adding a new hook, what about reusing the old poweroff
hook? There should not really be a difference between the two. My
proposed patch below:


>From 4f4681a94923e69b9e078db6f2cae585ecbbb612 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <[email protected]>
Date: Mon, 26 Sep 2011 16:01:45 +0200
Subject: [PATCH] hooks: move shutdown_poweroff before remounting / ro

This will make sure the same hook is run regardless of whether you pivot
to the shutdown ramfs or not. This is in order to run apcupsd --killpower
as pointed out by Gerardo.

Signed-off-by: Tom Gundersen <[email protected]>
---
 rc.shutdown |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/rc.shutdown b/rc.shutdown
index ea86f8f..38b22b0 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -75,6 +75,8 @@ fi
 [[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) && -d /sys/block ]] &&
        status "Deactivating LVM2 groups" vgchange --sysinit -a n &>/dev/null

+run_hook shutdown_poweroff
+
 if [[ -x /run/initramfs/shutdown ]]; then

        # decide what we want to do
@@ -113,8 +115,6 @@ else
        status "Remounting Root Filesystem Read-only" \
        mount -n -o remount,ro /

-       run_hook shutdown_poweroff
-
        # Power off or reboot
        printsep
        if [[ $RUNLEVEL = 0 ]]; then
-- 
1.7.6.4

Reply via email to