Migrate to docker.
This commit is contained in:
parent
9e03067d2f
commit
6e2c115dd2
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@ -0,0 +1,12 @@
|
||||
FROM debian:bookworm
|
||||
MAINTAINER yohan <783b8c87@scimetis.net>
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV TZ Europe/Paris
|
||||
RUN apt-get update && apt-get -y install gunicorn sqlite3 python3-pip python3-requests python3-yaml python3-flask python3-serial udev
|
||||
WORKDIR /root
|
||||
COPY find_ttyUSB.sh /root/
|
||||
COPY read_one-wire_sensor.py /root/
|
||||
COPY read_teleinfo.py /root/
|
||||
COPY read_yocto_sensor.py /root/
|
||||
COPY sensors-polling.py /root/
|
||||
ENTRYPOINT ["/root/sensors-polling.py"]
|
10
find_ttyUSB.sh
Normal file
10
find_ttyUSB.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
|
||||
syspath="${sysdevpath%/dev}"
|
||||
devname="$(udevadm info -q name -p $syspath)"
|
||||
[[ "$devname" == "ttyUSB"* ]] || continue
|
||||
eval "$(udevadm info -q property --export -p $syspath)"
|
||||
[[ -z "$ID_SERIAL" ]] && exit
|
||||
echo "/dev/$devname - $ID_SERIAL"
|
||||
done
|
25
install.sh
25
install.sh
@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
#Absolute path to this script
|
||||
SCRIPT=$(readlink -f $0)
|
||||
#Absolute path this script is in
|
||||
SCRIPTPATH=$(dirname $SCRIPT)
|
||||
SERVICE="sensors-polling"
|
||||
|
||||
cat << EOF > /etc/systemd/system/${SERVICE}.service
|
||||
[Unit]
|
||||
Description=Starting ${SERVICE}
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
ExecStart=$SCRIPTPATH/${SERVICE}.py
|
||||
WorkingDirectory=$SCRIPTPATH
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
systemctl enable ${SERVICE}.service
|
||||
|
Loading…
Reference in New Issue
Block a user