summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorpks <pks@pks.rocks>2022-11-22 22:11:11 +0100
committerpks <pks@pks.rocks>2022-11-22 22:11:11 +0100
commitd8f77f4312f713443d5b369432ab4b0413bfb8ec (patch)
tree92496712fc0ef27efa4872fb1868cdc879a3f582 /config
parente5b0a6660a898f6b60f11d6c3915fb813d06d5f8 (diff)
2022-11-22HEADmaster
Diffstat (limited to 'config')
-rw-r--r--config/logrotate/power-logger12
-rw-r--r--config/syslog/51power-logger.conf1
-rw-r--r--config/systemd/power-logger.service25
3 files changed, 38 insertions, 0 deletions
diff --git a/config/logrotate/power-logger b/config/logrotate/power-logger
new file mode 100644
index 0000000..089db74
--- /dev/null
+++ b/config/logrotate/power-logger
@@ -0,0 +1,12 @@
+/var/log/power_logger/logger.log {
+ rotate 7
+ daily
+ compress
+ size 100k
+ nocreate
+ missingok
+ postrotate
+ kill -HUP `cat /run/power_logger/logger.pid`
+ rm -f /run/power_logger/receiver.pid
+ endscript
+}
diff --git a/config/syslog/51power-logger.conf b/config/syslog/51power-logger.conf
new file mode 100644
index 0000000..c734814
--- /dev/null
+++ b/config/syslog/51power-logger.conf
@@ -0,0 +1 @@
+:programname, isequal, "power-logger" /var/log/power_logger/logger.log
diff --git a/config/systemd/power-logger.service b/config/systemd/power-logger.service
new file mode 100644
index 0000000..8774f96
--- /dev/null
+++ b/config/systemd/power-logger.service
@@ -0,0 +1,25 @@
+[Unit]
+Description=power-logger
+After=network.target
+StartLimitIntervalSec=0
+
+[Service]
+Type=simple
+Restart=always
+RestartSec=1
+User=power-logger
+Group=power-logger
+Environment=GEM_HOME=/usr/local/lib/ruby/gems
+StandardOutput=syslog
+StandardError=syslog
+SyslogIdentifier=power-logger
+PIDFile=/run/power_logger/logger.pid
+PermissionsStartOnly=true
+ExecStartPre=mkdir -p /run/power_logger /var/log/power_logger /usr/local/share/power_logger
+ExecStartPre=rm -f /run/power_logger/receiver.pid
+ExecStartPre=chown -R power-logger:power-logger /run/power_logger /var/log/power_logger /usr/local/share/power_logger
+ExecStopPost=rm -f /run/power_logger/logger.pid
+ExecStart=/usr/local/src/power_logger/power-logger
+
+[Install]
+WantedBy=multi-user.target