Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    APCUPSD: How to power off UPS

    Scheduled Pinned Locked Moved UPS Tools
    4 Posts 4 Posters 2.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bchan
      last edited by bchan

      I have an APC UPS connected to pfSense via a USB cable. The same UPS is powering a few other devices include a raspberry pi.

      What I wanted to achieve is after shutting down pfSense, I want to power off the UPS. As raspberry pi does not support WOL, a power cycle is the only way to get it up again when power line is restored.

      I had spent days reading APCUPSD manual and googling but I still miss some pieces in the puzzle.

      The doc said:
      During the shutdown of the system after apcupsd has been forced to exit, one of the last things done by the system shutdown is to call the halt script, which is usually in /etc/rc.d/halt or /etc/rc.d/init.d/halt, or possibly in /sbin/init.d/rc.0 depending on your system. If apcupsd was properly installed, this standard halt script was modified to include a bit of new logic just before the final halt of the system. It first tests if the file /etc/apcupsd/powerfail exists, and if it does, it executes /etc/apcupsd/apccontrol killpower. It is this last step that will cause apcupsd to be re-executed with the --killpower option on the command line. This option tells apcupsd to inform the UPS to kill the power.

      In particular my questions are how and where

      1. apcupsd will write the powerfail flag file and
      2. apcupsd will kill the power of the UPS via apccontroll --killpower
      3. Is there any halt script for pfSense? How and where can I create/modify one?
      4. Also what was the reason the following were commented out in apccontrol:
      case "$1" in
        killpower)
         printf "UPS now committed to shut down" | wall
      #   echo "Apccontrol doing: ${APCUPSD} --killpower"
      #   sleep 10
      #   ${APCUPSD} --killpower
        ;;
      

      Can anyone help me sorting out how to power off the UPS?

      B dennypageD S 3 Replies Last reply Reply Quote 0
      • B
        bavcon22 @bchan
        last edited by bavcon22

        @bchan If you power down the UPS with powerkill the all devices connected to UPS power line will lose their source of power, suddenly. If your pfsense appliance is connected to UPS it will also suddenly lose their power and stop without normal shutdown. This behavior it not good to your pfsense appliance, in long turn it will destroy it.

        Can you make a wiring diagram of the all ups and pfsense devices? What is the role of raspberry pi in this situation?

        1 Reply Last reply Reply Quote 0
        • dennypageD
          dennypage @bchan
          last edited by

          @bchan said in APCUPSD: How to power off UPS:

          The same UPS is powering a few other devices include a raspberry pi.

          What I wanted to achieve is after shutting down pfSense, I want to power off the UPS.

          I am not an apcupsd expert, but there is likely nothing you should have to do to achieve this. The apcupsd driver should instruct the ups to power down without any action required on your part. There is a delay in the ups that allows the os to finish shutting down prior to mains cut.

          Are you using a remote connection to apcupsd to shut down the other devices such as the pi?

          1 Reply Last reply Reply Quote 0
          • S
            SteveITS Galactic Empire @bchan
            last edited by

            @bchan there is a checkbox setting “Kill on Power Fail” already, is that not working?

            Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
            When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
            Upvote 👍 helpful posts!

            1 Reply Last reply Reply Quote 0
            • stephenw10S stephenw10 moved this topic from pfSense Packages on
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.