1
0
mirror of https://github.com/Nardo86/nut-docker.git synced 2025-06-05 21:49:27 +02:00

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 FROM debian
ENV NAME myups ENV NAME ups
ENV DRIVER usbhid-ups ENV DRIVER usbhid-ups
ENV PORT auto ENV PORT auto
ENV POLLFREQ 5 ENV POLLFREQ 5
ENV DESC UPS ENV DESC UPS
ENV USERSSTRING #
RUN apt-get update RUN apt-get update
RUN apt-get -y install nut-server RUN apt-get -y install nut-server

View File

@ -9,13 +9,20 @@ 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 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** **EXTRA OPTIONS**
Environment variable used for the configuration 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)
@ -25,4 +32,6 @@ Environment variable used for the configuration
**DESC** full description for your ups (default: UPS) **DESC** full description for your ups (default: UPS)
**USERSSTRING** single line users configuration (default: #)
*see https://networkupstools.org/stable-hcl.html for compatibility list *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 sed -i 's/MODE=none/MODE=netserver/g' /etc/nut/nut.conf
echo "LISTEN 0.0.0.0 3493" >> /etc/nut/upsd.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 "[$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 /etc/nut/*
chgrp nut /dev/bus/usb/*/* chgrp nut /dev/bus/usb/*/*