[Nut-upsuser] /var/state not accessible

Gaspar Bakos gbakos at cfa.harvard.edu
Wed Aug 10 15:24:30 UTC 2005


Hi,

I was trying to hack the /etc/rc.d/init.d/halt script under RH 9.0 in a
way to achieve a clean shutdown:
- commanding the RAID arrays to readonly mode
- turning off my hardware watchdog,
... etc. See details below.

At the end of all this preparation, and very close to the last lines of
the halt script, I would then issue:

1. /usr/bin/belkinunv -x wait /dev/ttyS0

2. (OR, with a smart ups:
$MODEL $OPTIONS -k $DEVICE
where $MODEL is the UPS driver with $OPTIONS, and killing the power
through e.g. $DEVICE=ttyS0)

The trouble is that by this time /var is unmounted, and the above #1 or
#2 commands do not execute, as they complain for /var/state being
unreadable (or writable?). At the end of the halt script, in all the
linuxes I know, only the "/" is mounted, and that is in readonly mode.

- Do you have any suggestions?
- Re-define the location of /var/state/ups to somewehere on "/"?
- Do the programs need read-only, or write access as well to /var/state?

Cheers
Gaspar

---------------------------------------------------------------------------
More info below;

System: Redhat 9.0, 2.4.* kernel
Nut: 2.0.2

There are two UPSes attached to the computer; one on ttyS0 giving power
to the computer itself, the other is ttyS1 giving power for another
equipment that also needs long and clean shutdown. If there is a power
outage, I would like to shut down after 2 minutes, and not wait any
more. The shutdown time is pretty long, and thus I 'panic' after 2
minutes of loss of power. Therefore, I use the upssched and
upssched-cmd utilities.

ups.conf:
--------
[hat_PC_ups]
        driver = belkinunv
        port = /dev/ttyS0
        sdorder = 0
[hat_HAT_ups]
        driver = belkinunv
        port = /dev/ttyS1
        sdorder = 0

upsd.conf:
---------
ACL all 0.0.0.0/0
ACL localhost 127.0.0.1/32
ACCEPT localhost
REJECT all

upsd.users
----------
[nut]
        password = ******
        allowfrom = localhost 127.0.0.1
        actions = SET
        instcmds = ALL
        upsmon master

upsmon.conf
------------
RUN_AS_USER nut
MONITOR hat_PC_ups at localhost 1 nut **** master
MONITOR hat_HAT_ups at localhost 1 nut **** master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +1"
NOTIFYCMD /usr/sbin/upssched
POLLFREQ 10
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 30
POWERDOWNFLAG /etc/killpower
NOTIFYMSG ONLINE "Power restored on UPS: %s"
NOTIFYMSG ONBATT "Power failure detected on UPS: %s"
NOTIFYMSG LOWBATT "Low battery status reached on UPS: %s"
NOTIFYMSG FSD "Forced shutdown due on UPS: %s"
NOTIFYFLAG ONLINE SYSLOG+EXEC
NOTIFYFLAG ONBATT EXEC+SYSLOG
NOTIFYFLAG LOWBATT SYSLOG+EXEC
NOTIFYFLAG FSD SYSLOG+EXEC
NOTIFYFLAG SHUTDOWN SYSLOG+EXEC
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5

upscsched-cmd
--------------

case $1 in
        "onbattwarn_hat_PC_ups")
                logger -t upssched-cmd "PC UPS timeout expired, shutdown"
                /usr/sbin/upsmon -c fsd
                ;;
        "onbattwarn_hat_HAT_ups")
                logger -t upssched-cmd "HAT UPS timeout expired, closing power plant";
                /etc/rc.d/init.d/HATstartstop stop
                ;;
        *)
                logger -t upssched-cmd "Unrecognized command: $1"
                ;;
esac

upssched.conf
-------------
CMDSCRIPT /etc/ups/upssched-cmd
PIPEFN /var/state/ups/upssched.pipe
LOCKFN /var/state/ups/upssched.lock
AT ONBATT hat_PC_ups at localhost START-TIMER onbattwarn_hat_PC_ups 120
AT ONLINE hat_PC_ups at localhost CANCEL-TIMER onbattwarn_hat_PC_ups
AT ONBATT hat_HAT_ups at localhost START-TIMER onbattwarn_hat_HAT_ups 120
AT ONLINE hat_HAT_ups at localhost CANCEL-TIMER onbattwarn_hat_HAT_ups



More information about the Nut-upsuser mailing list