User Tools

Site Tools


pfsense-nut-ups

NUT UPS pfsense shutdown timer

I found it hard with the documentation available, to set my pfSense to shutdown after 5 minutes of being on UPS battery.

This article should help you setup a timer of 5 minutes which starts after pfsense goes on to battery.

So after much messing around, this is how I managed it (using bits and pieces from around the net and rial and error)

The Steps

First install the NUT package using the web gui in pfSense.

Get NUT setup in the gui and working before going any further.

In the web gui under the advance upsmon.conf box at this:

NOTIFYCMD /usr/pbi/nut-amd64/bin/upssched;
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC;
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC;

click change

Now do at the command prompt:

chmod 777 /usr/pbi/nut-amd64/local/etc/nut

create /usr/pbi/nut-amd64/local/etc/nut/upssched.conf and put this in:

CMDSCRIPT /usr/pbi/nut-amd64/local/etc/nut/upssched-cmd
PIPEFN /usr/pbi/nut-amd64/local/etc/nut/upssched.pipe
LOCKFN /usr/pbi/nut-amd64/local/etc/nut/upssched.lock
AT ONBATT * START-TIMER onbattwarn 180
AT ONLINE * CANCEL-TIMER onbattwarn

create /usr/pbi/nut-amd64/local/etc/nut/upssched-cmd and put this in:

#! /bin/sh

        case $1 in
                onbattwarn)
                        /usr/pbi/nut-amd64/bin/upsmon -c fsd
                        ;;
                *)
                        logger -t upssched-cmd "Unrecognized command: $1"
                        ;;
        esac

now make it executable

chmod +x /usr/pbi/nut-amd64/local/etc/nut/upssched-cmd

Restart the NUT service and test. After 5 mins the pfsense should shutdown. If power comes back on within the 5 minutes then the shutdown timer should cancel.

pfsense-nut-ups.txt · Last modified: 1980/01/13 22:05 by chris