Displaying 1 result from an estimated 1 matches for "no_wait_time".
2022 Dec 22
3
NUT & UPS, how to shut down client after 2 min on battery?
...out NUT, but after some Googling, one idea I have is to in /etc/nut/upsmon.conf on client change to this
NOTIFYCMD "/etc/nut/shutdown_script.sh"
NOTIFYFLAG ONBATT EXEC
And then in /etc/nut/shutdown_script.sh have something like this
#!/bin/bash
poll_interval=5
wait_time=120
counter=0
no_wait_time=60
no_counter=0
while true
do
  output=$(upsc qnapups at 192.168.222.252 ups.status)
  if echo "$output" | grep -q "OB"
  then
    counter=$((counter + poll_interval))
    no_counter=0
  else
    counter=0
    no_counter=$((no_counter + poll_interval))
  fi
  if [ $counter -ge...