summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorHendrik Jäger <gitcommit@henk.geekmail.org>2022-05-04 20:49:32 +0200
committerHendrik Jäger <gitcommit@henk.geekmail.org>2022-05-22 20:04:54 +0200
commit087f73b5c34b887fd774bda4251c5084d6631679 (patch)
treeb7eb5d9e0d00babf20d633361c1b13849e9f25f5 /templates
parentc4bc0fecb2a92d8b713cac93cae7141b4b56a542 (diff)
rotate logs of system services, but not user services
Diffstat (limited to 'templates')
-rw-r--r--templates/etc/s6-services/s6-logrotater/run.epp12
1 files changed, 12 insertions, 0 deletions
diff --git a/templates/etc/s6-services/s6-logrotater/run.epp b/templates/etc/s6-services/s6-logrotater/run.epp
new file mode 100644
index 0000000..347f85d
--- /dev/null
+++ b/templates/etc/s6-services/s6-logrotater/run.epp
@@ -0,0 +1,12 @@
+<% if versioncmp( $facts['os']['release']['major'], '10' ) >= 1 { -%>
+#!/usr/bin/execlineb -P
+<% } else { -%>
+#!/usr/local/bin/execlineb -P
+<% } -%>
+
+foreground { sleep 10m }
+
+forbacktickx -p s6svc { ls -1N /etc/s6-scandir/ }
+importas -u s6svc s6svc
+if { test -d /etc/s6-scandir/\${s6svc}/log }
+s6-svc -a /etc/s6-scandir/\${s6svc}/log