Help scrip to Auto power off when lost electric power

thanhphat

New Member
Mar 23, 2023
4
0
1
Dear all,
I have an ideal about auto turn off pve when cutting off electric power.
1. my home pve running with in usp APC 650. (and UPS will turn off after 15 minutes)
2. other Dump AP running without UPS.
So can we have any script running can do:
1. when Dump AP lost power, PVE sending a small script such as checking DumAP alive or not. If Dump AP did not alive, then PVE auto turn off.
2. or do you have any ideal todo that.

My home pve running on HP mini 600G2, i5 6500T, 16gb, PROXMOX 8 and serving by UPS
Thanks you
 
I found out a scrip from web, but is use to reboot only, is there any command turn off?
Code:
#!/bin/sh
while [ 1 ]; do
#ping 1 packet and wait an answer for 2 seconds
        ping -q -c 1 -W 2 -I wwan0 1.1.1.1 >/dev/null
        RESULT=$?
        if [ $RESULT -ne 0 ]; then
                /etc/init.d/modemmanager stop
                sleep 2
                /etc/init.d/modemmanager start
                sleep 60
                echo "ristarted"
        fi
# wait 10 seconds for the text ping
        sleep 10
done
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!