diff --git a/Dockerfile b/Dockerfile index 0ac5599..1f5389c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index d574309..e01d5dd 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 3f746d1..9c3f65e 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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/*/*