commit ca8f7a7acd473e430b04949328a23d157f32bd3b Author: Eros Nardi Date: Sat Jan 2 16:54:47 2021 +0100 0 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fee0707 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM debian + +ENV NAME myups +ENV DRIVER usbhid-ups +ENV PORT auto +ENV POLLFREQ 5 +ENV DESC UPS + +RUN apt-get update && apt-get -y install nut-server + +COPY entrypoint.sh / +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 3493 diff --git a/README.md b/README.md new file mode 100644 index 0000000..7e17a0a --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# nut-docker + +This Dockerfiles is tested to run on Raspberry Pi 4 + +Expects a UPS usb device passed to it with --device, find it with lsusb ex./dev/bus/usb/001/005 diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..3f746d1 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +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 + +chgrp nut /etc/nut/* +chgrp nut /dev/bus/usb/*/* + +upsdrvctl start + +exec upsd -D \ No newline at end of file