summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/config.yaml34
-rw-r--r--config/logrotate/weather-logger-receiver12
-rw-r--r--config/syslog/50weather-logger-receiver.conf1
-rw-r--r--config/systemd/weather-logger-receiver.service22
4 files changed, 55 insertions, 14 deletions
diff --git a/config/config.yaml b/config/config.yaml
index 0986e39..332f6b9 100644
--- a/config/config.yaml
+++ b/config/config.yaml
@@ -1,14 +1,20 @@
-Berlin:
- "f4:01":
- handle: "inside"
- type: "THGR810, THGN800"
- "1f:01":
- handle: "outside"
- type: "BTHR918"
-Heidenheim:
- "07:01":
- handle: "inside"
- type: "THC238/268,THN132,THWR288,THRN122,THN122,AW129/131"
- "58:02":
- handle: "outside"
- type: "THGR810, THGN800"
+log_file_path: /var/log/weather_logger/receiver.log
+pid_file_path: /run/weather_logger/receiver.log
+
+locations:
+ Berlin:
+ "f4:01":
+ handle: "inside"
+ type: "THGR810, THGN800"
+ "1f:01":
+ handle: "outside"
+ type: "BTHR918"
+ Heidenheim:
+ "07:01":
+ handle: "inside"
+ type: "THC238/268,THN132,THWR288,THRN122,THN122,AW129/131"
+ "58:02":
+ handle: "outside"
+ type: "THGR810, THGN800"
+
+active-location: Berlin
diff --git a/config/logrotate/weather-logger-receiver b/config/logrotate/weather-logger-receiver
new file mode 100644
index 0000000..c83fbd5
--- /dev/null
+++ b/config/logrotate/weather-logger-receiver
@@ -0,0 +1,12 @@
+/var/log/weather_logger/receiver.log {
+ rotate 7
+ daily
+ compress
+ size 100k
+ nocreate
+ missingok
+ postrotate
+ kill -HUP `cat /run/weather_logger/receiver.pid`
+ rm -f /run/weather_logger/receiver.pid
+ endscript
+}
diff --git a/config/syslog/50weather-logger-receiver.conf b/config/syslog/50weather-logger-receiver.conf
new file mode 100644
index 0000000..9ac4088
--- /dev/null
+++ b/config/syslog/50weather-logger-receiver.conf
@@ -0,0 +1 @@
+:programname, isequal, "weather-logger-receiver" /var/log/weather_logger/receiver.log
diff --git a/config/systemd/weather-logger-receiver.service b/config/systemd/weather-logger-receiver.service
new file mode 100644
index 0000000..f56c915
--- /dev/null
+++ b/config/systemd/weather-logger-receiver.service
@@ -0,0 +1,22 @@
+[Unit]
+Description=weather-logger-receiver
+After=network.target
+StartLimitIntervalSec=0
+
+[Service]
+Type=simple
+Restart=always
+RestartSec=1
+User=pks
+Group=pks
+Environment=PYTHONUNBUFFERED=1
+StandardOutput=syslog
+StandardError=syslog
+SyslogIdentifier=weather-logger-receiver
+PIDFile=/run/weather_logger/receiver.pid
+ExecStart=/usr/local/src/weather_logger/weather-logger-receiver Berlin
+ExecStartPre=rm -f /run/weather_logger/receiver.pid
+ExecStopPost=rm -f /run/weather_logger/receiver.pid
+
+[Install]
+WantedBy=multi-user.target