From e95d3da991d40a0ad85ba91ad83b84a0c224b1de Mon Sep 17 00:00:00 2001 From: pks Date: Tue, 22 Nov 2022 22:05:29 +0100 Subject: 2022-11-22 --- config/install | 17 ----------------- config/systemd/weather-logger-receiver.service | 5 ++++- config/weather-logger-receiver.yaml | 2 +- scripts/install.sh | 18 ++++++++++++++++++ 4 files changed, 23 insertions(+), 19 deletions(-) delete mode 100755 config/install create mode 100755 scripts/install.sh diff --git a/config/install b/config/install deleted file mode 100755 index 9891c58..0000000 --- a/config/install +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -sudo ln -s $(pwd)/weather-logger-receiver.yaml /etc/ -sudo ln -s $(pwd)/systemd/weather-logger-receiver.service /etc/systemd/system/ -sudo systemctl daemon-reload -sudo ln -s $(pwd)/syslog/50weather-logger-receiver.conf /etc/rsyslog.d/ -sudo systemctl restart rsyslog -sudo ln -s $(pwd)/logrotate/weather-logger-receiver /etc/logrotate.d/ -sudo systemctl restart logrotate - -sudo useradd -M -s /bin/bash -G dialout weather-logger - -for prefix in /run /var/log /usr/local/share; do - sudo mkdir -p $prefix/weather_logger - sudo chown -R weather-logger:weather-logger $prefix/weather_logger - sudo chmod -R 755 $prefix/weather_logger -done diff --git a/config/systemd/weather-logger-receiver.service b/config/systemd/weather-logger-receiver.service index d771e59..4496fce 100644 --- a/config/systemd/weather-logger-receiver.service +++ b/config/systemd/weather-logger-receiver.service @@ -14,9 +14,12 @@ StandardOutput=syslog StandardError=syslog SyslogIdentifier=weather-logger-receiver PIDFile=/run/weather_logger/receiver.pid -ExecStart=/usr/local/src/weather_logger/weather-logger-receiver /etc/weather-logger-receiver.yaml +PermissionsStartOnly=true +ExecStartPre=mkdir -p /run/weather_logger /var/log/weather_logger /usr/local/share/weather_logger ExecStartPre=rm -f /run/weather_logger/receiver.pid +ExecStartPre=chown -R weather-logger:weather-logger /run/weather_logger /var/log/weather_logger /usr/local/share/weather_logger ExecStopPost=rm -f /run/weather_logger/receiver.pid +ExecStart=/usr/local/src/weather_logger/weather-logger-receiver /etc/weather-logger-receiver.yaml [Install] WantedBy=multi-user.target diff --git a/config/weather-logger-receiver.yaml b/config/weather-logger-receiver.yaml index e92c00e..c7080b0 100644 --- a/config/weather-logger-receiver.yaml +++ b/config/weather-logger-receiver.yaml @@ -6,7 +6,7 @@ pid_file_path: "/run/weather_logger/receiver.pid" locations: Berlin: - "f4:01": + "bc:01": handle: "inside" type: "THGR810, THGN800" "1f:01": diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..6cdce59 --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +pip install --prefix /usr/local -r config/requirements.txt +sudo ln -s $(pwd)/weather-logger-receiver.yaml /etc/ +sudo ln -s $(pwd)/systemd/weather-logger-receiver.service /etc/systemd/system/ +sudo systemctl daemon-reload +sudo ln -s $(pwd)/syslog/50weather-logger-receiver.conf /etc/rsyslog.d/ +sudo systemctl restart rsyslog +sudo ln -s $(pwd)/logrotate/weather-logger-receiver /etc/logrotate.d/ +sudo systemctl restart logrotate + +sudo useradd -M -s /bin/bash -G dialout weather-logger + +for prefix in /run /var/log /usr/local/share; do + sudo mkdir -p $prefix/weather_logger + sudo chown -R weather-logger:weather-logger $prefix/weather_logger + sudo chmod -R 755 $prefix/weather_logger +done -- cgit v1.2.3