Assuming you don’t have the problem in the next question, then you probably have an ATX motherboard, have APM or ACPI enabled in your kernel (assuming Linux here), and are reaching the halt at the bottom of your shutdown scripts.
Your machine obeys and shuts down, and stays down, since it remembers the last state when the UPS restarts.
One solution is to change your shutdown scripts so you never reach
that point. You want the system to die without reaching the
part where the kernel tells it to shut down. A possible script
might look like this (see scripts/systemd/nutshutdown in NUT
sources for a more streamlined and modern variant):
# other shutdown stuff here (mount -o remount,ro ...)
# `upsmon -K` if available on still mounted filesystems
# at this point is more portable than the `test` below
if (test -f /etc/killpower || /sbin/upsmon -K)
then
/sbin/upsdrvctl shutdown
sleep 600 # this should never return
# uh oh, we never got shut down! (power race?)
reboot
fi
halt -pFor more details and a better integrated example, please see https://github.com/networkupstools/nut/blob/master/scripts/systemd/nutshutdown.in (a copy tailored for your OS distribution may be or not be included in NUT packages, if you installed from those).
The NUT-provided nutshutdown and its derivatives in packages
provided by OS distributions are subject to proper NUT configuration,
such as that you do not keep MODE=none in nut.conf (at which point
the standard shutdown hook script would exit without doing anything).
The other solution is to change your BIOS setting to "always power on" instead of "last state", assuming that’s possible.