1
0
Fork 0

Sinology compatibility

This commit is contained in:
Eros Nardi 2021-01-08 12:50:14 +01:00
parent 2f78c78004
commit ec1910f74b
3 changed files with 15 additions and 4 deletions

View File

@ -1,10 +1,11 @@
FROM debian
ENV NAME myups
ENV NAME ups
ENV DRIVER usbhid-ups
ENV PORT auto
ENV POLLFREQ 5
ENV DESC UPS
ENV USERSSTRING #
RUN apt-get update
RUN apt-get -y install nut-server

View File

@ -9,15 +9,22 @@ Image available at https://hub.docker.com/r/nardo86/nut-server
Just run the image publishing the port and pointing to the ups device path. Use lsusb to find the current Bus and Device
docker run -d -p 3493:3493 --name=Nut --restart unless-stopped --device=/dev/bus/usb/001/005 nardo86/nut-server
`docker run -d -p 3493:3493 --name=Nut --restart unless-stopped --device=/dev/bus/usb/001/005 nardo86/nut-server`
All the settings for the UPS are customizable like the name, driver, Port, Polling frequency and the description using the enviroment variables.
It is also possibile to insert an user, for example it's possibile to make the service compatible with Synology NAS changing the USERSSTRING like
`-e USERSSTRING='[monuser] \n password = secret \n upsmon slave'`
**EXTRA OPTIONS**
Environment variable used for the configuration
**NAME** a simple name for your ups (default: myups)
**NAME** a simple name for your ups (default: ups)
**DRIVER** the driver to use* (default: usbhid-ups)
**DRIVER** the driver to use* (default: usbhid-ups)
**PORT** device port (default: auto)
@ -25,4 +32,6 @@ Environment variable used for the configuration
**DESC** full description for your ups (default: UPS)
**USERSSTRING** single line users configuration (default: #)
*see https://networkupstools.org/stable-hcl.html for compatibility list

View File

@ -3,6 +3,7 @@
sed -i 's/MODE=none/MODE=netserver/g' /etc/nut/nut.conf
echo "LISTEN 0.0.0.0 3493" >> /etc/nut/upsd.conf
echo -e "[$NAME] \n driver = $DRIVER \n port = $PORT \n pollfreq = $POLLFREQ \n desc = $DESC" >> /etc/nut/ups.conf
echo -e "$USERSSTRING" >> /etc/nut/upsd.users
chgrp nut /etc/nut/*
chgrp nut /dev/bus/usb/*/*