parent
33c0d5bd5f
commit
546874eea8
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
upsname="{{ upsname }}"
|
||||
retries=5
|
||||
retry_delay=30
|
||||
|
||||
# Check dependencies
|
||||
which upsc >/dev/null || exit 1
|
||||
|
||||
upsstat=1 # just to bootstrap the loop
|
||||
|
||||
while [ $upsstat -ne 0 ]; do
|
||||
upsc $upsname
|
||||
upsstat=$?
|
||||
if [ $upsstat -eq 1 ]; then
|
||||
let retries=retries-1
|
||||
if [ $retries -le 0 ]; then
|
||||
reboot
|
||||
fi
|
||||
sleep $retry_delay
|
||||
fi
|
||||
done
|
Loading…
Reference in new issue