How to Set Up Automatic Shutdown and Notify Other Devices After Power Failure with a Home QNAP NAS UPS

This article was last updated on: May 17, 2026 am

Scenario

│ 📝Note:

│ Please go easy on me. 😅

│ I’m truly hopeless when it comes to cable management. This is the best I can do. 😂

My HomeLab server cluster is configured as follows.

HomeLab Upper Section

HomeLab Lower Section

The upper section has been introduced before, so I won’t go over it again. Today we’ll focus on the UPS and NAS parts.

  • 1 UPS, model APC Back-UPS 650. Plugged into its outlets: the NAS and a power strip (the power strip connects 4 N100 mini PCs and other devices; the UPS is connected to the NAS via a data port). As shown below: (Please go easy on me. 😅)

UPS

  • 1 QNAP TS-453Bmini NAS. As shown below: (Please go easy on me. 😅)

QNAP NAS

The requirements are:

  1. After a power outage, the NAS should automatically shut down after a period of time (e.g., 5 minutes);
  2. The NAS acts as a UPS Server, notifying the other 4 N100 mini PCs when power is lost;
  3. The 4 N100 mini PCs should also automatically shut down after a period of time (e.g., 5 minutes) upon receiving the notification.

Here’s an overview of the implementation:

  1. Physical layer: UPS connected to the NAS via USB data cable
  2. Software layer:
    1. NAS: Configure post-power-failure behavior via the UI;
    2. NAS: Enable UPS Server configuration via the UI;
    3. N100 mini PCs: UPS Client configuration.

Detailed steps below:

Hands-On

1. Physical Layer: Connect UPS to NAS USB via Data Cable

I won’t post a photo here because it’s buried somewhere in that pile of cables… The rack is in a corner, and after kneeling left and right I couldn’t find an angle that would produce a clear shot… 😅

The APC UPS comes with a data cable. Here’s what to do:

Connect the Back-UPS to the NAS using the USB cable. Plug one end into the POWERCHUTE port on the back panel of the Back-UPS, and the other end into a USB port on the NAS.

That’s item ⑥ in the diagram below:

APC Diagram

Done.

Verification

Once connected, you can access the QNAP QTS interface and see the UPS information as follows:

QTS External Devices

QTS UPS Information

Now let’s move on to the software configuration.

2. NAS: Configure Post-Power-Failure Behavior via UI

Here’s how:

QNAP QTS UPS Settings Interface

  1. Open the QNAP QTS interface;
  2. Navigate to Control Panel -> System -> External Device -> UPS
  3. Select USB Connection -> Enter auto-protection mode 10 minutes after power failure. (Of course, you can choose the other option: Shut down the NAS)

If you only need the UPS and NAS to work together, the configuration is complete at this point.

3. NAS: Enable UPS Server Configuration via UI

If you also need to coordinate with other hosts/servers, you need to enable the UPS Server configuration via the UI. Specifically, as shown in item ⑥ above:

  1. Enable the Network UPS Server (i.e., UPS Server)
  2. Add the IP addresses of the 4 N100 mini PCs. For example: 192.168.3.154

Done.

Additional Notes

Behind the scenes, QNAP QTS actually runs the upsd service, listening on port 3493. As shown below:

1
2
3
4
5
6
7
[admin@NAS33657A ups]# netstat -tuln | grep 3493
tcp 0 0 0.0.0.0:3493 0.0.0.0:* LISTEN
[admin@NAS33657A ups]# ps -ef|grep ups
6960 admin 996 S grep ups
14369 admin 1764 R /usr/local/ups/bin/usbhid-ups -a qnapups -u admin
15999 admin 1536 S /usr/sbin/upsd -u admin
23676 admin 8548 S /usr/sbin/upsutil

What we need to know here:

  1. The QNAP UPS Server name is: qnapups

The QNAP QTS UPS configuration files are located in the /etc/config/ups/ directory:

1
2
3
4
5
6
7
8
9
10
[admin@NAS33657A ups]# ls
ups.conf upsd.conf upsdrv.map upsd.users upsmon.conf

[admin@NAS33657A ups]# cat upsd.users
[admin]
password = 123456
allowfrom = localhost
actions = SET
instcmds = ALL
upsmon master # or upsmon slave

What we need to know here:

  1. The QNAP UPS Server username is: admin
  2. The password is: 123456

To summarize, QNAP QTS Server information:

  1. It runs the upsd service under the hood
  2. Listening on port 3493
  3. The UPS Server name is: qnapups (🐾 Note: This name is fixed across all QNAP NAS devices)
  4. Username: admin
  5. Password: 123456

This information will be needed later when configuring the UPS Client on the N100 machines.

4. N100 Mini PCs: UPS Client Configuration

My N100 mini PCs run Ubuntu 24.04. To interact with a UPS server on a Linux system and automatically shut down 5 minutes after a power outage, you typically need UPS monitoring software. The most common tool is NUT (Network UPS Tools), an open-source UPS monitoring and management tool.

Since upsd is already running on the NAS and the UPS is an APC Back-UPS 650 connected to the NAS via USB, you can configure the NUT client (upsmon) on the mini PCs to interact with the NAS’s upsd and achieve automatic shutdown 5 minutes after power loss.

Here are the detailed steps:

4.1. Install the NUT Client on Linux Devices

On the Linux devices that need to monitor the UPS, install the NUT client tools:

  • For Debian/Ubuntu-based systems:

    1
    2
    sudo apt-get update
    sudo apt-get install nut-client
  • For Red Hat/CentOS-based systems:

    1
    sudo yum install nut-client

4.2. Configure the NUT Client

On the Linux device, edit the NUT client configuration file /etc/nut/upsmon.conf and add the following:

1
MONITOR qnapups@nas_ip 1 admin 123456 slave
  • qnapups: The UPS name on the QNAP NAS (🐾 Note: This name is fixed across all QNAP NAS devices).
  • nas_ip: The IP address of the NAS.
  • admin: The username defined on the NAS.
  • 123456: The password defined on the NAS.
  • slave: Indicates this device is a client, not the master.

4.3. Set Up Shutdown After Power Failure

In /etc/nut/upsmon.conf, add the following line to shut down 5 minutes after power loss:

1
SHUTDOWNCMD "/sbin/shutdown -h +5"

4.4. Set the NUT Operating Mode

In /etc/nut/nut.conf, there are 4 operating modes:

  1. none: NUT is not configured, or uses integrated power management, or some external system starts NUT components. Therefore, no scripts or services bundled with the NUT package need to start anything.
  2. standalone: This mode is for local-only configurations where 1 UPS protects the local system. It requires starting all 3 NUT layers (driver, upsd, and upsmon) with their corresponding configuration files. This mode can also handle UPS redundancy.
  3. netserver: Same as standalone, but also requires some additional network access controls (firewall, TCP wrappers) and possibly a specific LISTEN directive in upsd.conf. Since this mode is open to the network, special attention should be paid to security. – Clearly, the NAS UPS Server uses this mode.
  4. netclient: This mode only requires upsmon (and any tools it may use, such as upssched or custom scripts) to monitor a remote NUT server and potentially shut down the local system (in which case, part of upsmon must run as root). – Clearly, this is the mode we need for the Linux devices.

Set the mode configuration to:

1
MODE=netclient

4.4. Start the NUT Client Service

Start the upsmon service and enable it at boot:

  • For systemd-based systems:

    1
    2
    sudo systemctl start nut-client
    sudo systemctl enable nut-client
  • For SysVinit-based systems:

    1
    2
    sudo service nut-client start
    sudo update-rc.d nut-client defaults

Check the service status:

4.4.1 Error Fix

The first startup produced an error, specifically:

  1. Failed to open ‘/usr/lib/tmpfiles.d/nut-common-tmpfiles.conf’: No such file or directory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
sudo systemctl status nut-client.service
○ nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller
Loaded: loaded (/usr/lib/systemd/system/nut-monitor.service; enabled; preset: enabled)
Active: inactive (dead) since Sat 2025-03-22 17:12:20 CST; 8s ago
Duration: 5ms
Process: 347996 ExecStartPre=/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-common-tmpfiles.conf (code=exited, status=1/FAILURE)
Process: 347998 ExecStart=/sbin/upsmon -F (code=exited, status=0/SUCCESS)
Main PID: 347998 (code=exited, status=0/SUCCESS)
CPU: 15ms

Mar 22 17:12:20 n100-jumper-2 systemd[1]: Starting nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller...
Mar 22 17:12:20 n100-jumper-2 systemd-tmpfiles[347996]: Failed to open '/usr/lib/tmpfiles.d/nut-common-tmpfiles.conf': No such file or directory
Mar 22 17:12:20 n100-jumper-2 systemd[1]: Started nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller.
Mar 22 17:12:20 n100-jumper-2 nut-monitor[347998]: upsmon disabled, please adjust the configuration to your needs
Mar 22 17:12:20 n100-jumper-2 nut-monitor[347998]: Then set MODE to a suitable value in /etc/nut/nut.conf to enable it
Mar 22 17:12:20 n100-jumper-2 systemd[1]: nut-monitor.service: Deactivated successfully.

Fix it by running:

1
sudo touch /usr/lib/tmpfiles.d/nut-common-tmpfiles.conf

After restarting, no more errors:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
sudo systemctl status nut-client.service 
● nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller
Loaded: loaded (/usr/lib/systemd/system/nut-monitor.service; enabled; preset: enabled)
Active: active (running) since Sat 2025-03-22 17:15:21 CST; 2s ago
Process: 350296 ExecStartPre=/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-common-tmpfiles.conf (code=exited, status=0/SUCCESS)
Main PID: 350298 (upsmon)
Tasks: 2 (limit: 18754)
Memory: 3.6M (peak: 3.8M)
CPU: 22ms
CGroup: /system.slice/nut-monitor.service
├─350298 /lib/nut/upsmon -F
└─350310 /lib/nut/upsmon -F

Mar 22 17:15:21 n100-jumper-2 systemd[1]: Starting nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller...
Mar 22 17:15:21 n100-jumper-2 systemd[1]: Started nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller.
Mar 22 17:15:21 n100-jumper-2 nut-monitor[350298]: fopen /run/nut/upsmon.pid: No such file or directory
Mar 22 17:15:21 n100-jumper-2 nut-monitor[350298]: Could not find PID file to see if previous upsmon instance is already running!
Mar 22 17:15:21 n100-jumper-2 nut-monitor[350298]: Using power down flag file /etc/killpower
Mar 22 17:15:21 n100-jumper-2 nut-monitor[350298]: UPS: qnapups@192.168.3.216 (secondary) (power value 1)
Mar 22 17:15:21 n100-jumper-2 nut-monitor[350310]: Init SSL without certificate database

4.5. Test the Configuration

4.5.1 Check UPS Status

On the Linux device, use the following command to verify that UPS status can be retrieved correctly:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
❯ upsc qnapups@192.168.3.216
Init SSL without certificate database
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: not set
battery.mfr.date: 2019/12/10
battery.runtime: 1140
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 13.7
battery.voltage.nominal: 12.0
device.mfr: APC
device.model: Back-UPS 650
device.serial: 3B1950X62634
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/ttyS1
driver.parameter.synchronous: no
driver.version: 2.7.4
driver.version.data: APC HID 0.96
driver.version.internal: 0.41
input.sensitivity: low
input.transfer.high: 266
input.transfer.low: 165
input.transfer.reason: input voltage out of range
input.voltage: 226.0
input.voltage.nominal: 220
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.firmware: 822.A3.I
ups.firmware.aux: A3
ups.load: 38
ups.mfr: APC
ups.mfr.date: 2019/12/10
ups.model: Back-UPS 650
ups.productid: 0002
ups.serial: 3B1950X62634
ups.status: OL
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d

If configured correctly, you should see detailed UPS information such as battery status, input voltage, etc.

4.5.2 Simulate a Power Outage Test

You can test the configuration by disconnecting the UPS from the power source. If everything is working properly, the Linux devices should automatically shut down 5 minutes after the power outage.

All done! 🎉🎉🎉

5. Other Considerations

  • Firewall Configuration: Make sure the NAS firewall allows connections from the Linux devices on port 3493.
  • Permission Issues: If you’re using a different NAS, ensure the permissions defined in the upsd.users file on the NAS allow client devices to access UPS information.
  • Time Synchronization: Ensure the NAS and Linux devices have synchronized clocks to avoid monitoring issues caused by time discrepancies.

Summary

By following the steps above, you should be able to achieve:

When the UPS loses power:

  1. The NAS shuts down automatically
  2. The other Linux devices shut down automatically

🎉🎉🎉


How to Set Up Automatic Shutdown and Notify Other Devices After Power Failure with a Home QNAP NAS UPS
https://e-whisper.com/posts/55656/
Author
east4ming
Posted on
March 22, 2025
Licensed under