Compare commits
2 commits
33f8f69be3
...
c090894009
Author | SHA1 | Date | |
---|---|---|---|
|
c090894009 | ||
|
e0f6cfe931 |
1 changed files with 28 additions and 0 deletions
28
openwrt/openwrt-configure-nut-ups.sh
Executable file
28
openwrt/openwrt-configure-nut-ups.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius, 2024-08-17
|
||||
# create configuration for nut based on available usb ups
|
||||
|
||||
|
||||
if [ $# -lt 1 ] ; then
|
||||
echo $0 "address"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
address=$1; shift
|
||||
|
||||
cat <<EOF | ssh -t "root@${address}"
|
||||
set -x
|
||||
i=1
|
||||
|
||||
for ups in \$(lsusb -vv 2>/dev/null | grep -e "iProduct.* UPS" -e "iProduct.*Innova Unity" -A1 | awk '/iSerial/ { print \$3 }'); do
|
||||
|
||||
uci set nut_server.ups\${i}=driver
|
||||
uci set nut_server.ups\${i}.port=auto
|
||||
uci set nut_server.ups\${i}.driver=usbhid-ups
|
||||
uci set nut_server.ups\${i}.serial=\$ups
|
||||
|
||||
i=\$((i+1))
|
||||
|
||||
done
|
||||
|
||||
uci commit
|
Loading…
Add table
Reference in a new issue