]> Frank Brehm's Git Trees - config/vera/etc.git/commitdiff
saving uncommitted changes in /etc prior to apt run
authorFrank Brehm <frank@brehm-online.com>
Fri, 7 Sep 2018 05:28:46 +0000 (07:28 +0200)
committerFrank Brehm <frank@brehm-online.com>
Fri, 7 Sep 2018 05:28:46 +0000 (07:28 +0200)
.etckeeper
cron.daily/logrotate
logrotate.conf
logrotate.d/btmp
logrotate.d/wtmp
systemd/system/logrotate.service.d/exec-script.conf [new file with mode: 0644]

index 438cd1d88733f38ca7b08378c0098c85e2ff50c7..c5c97b1ab4cb801fb93be30efe51daf2b2113ce4 100755 (executable)
@@ -653,6 +653,8 @@ maybe chmod 0755 'systemd/system/default.target.wants'
 maybe chmod 0755 'systemd/system/getty.target.wants'
 maybe chmod 0755 'systemd/system/getty@.service.d'
 maybe chmod 0644 'systemd/system/getty@.service.d/noclear.conf'
+maybe chmod 0755 'systemd/system/logrotate.service.d'
+maybe chmod 0644 'systemd/system/logrotate.service.d/exec-script.conf'
 maybe chmod 0755 'systemd/system/multi-user.target.wants'
 maybe chmod 0755 'systemd/system/network-online.target.wants'
 maybe chmod 0755 'systemd/system/sockets.target.wants'
index 189da6a85946220db6ad7d379efdb9151a264ccc..ae30c1d5f28b206e31c8f4b1cc243764b5153e2e 100755 (executable)
@@ -1,9 +1,23 @@
 #!/bin/bash
 
-test -x /usr/sbin/logrotate || exit 0
+# skip in favour of systemd timer
+if [[ -d /run/systemd/system ]]; then
+    exit 0
+fi
+
+# this cronjob persists removals (but not purges)
+if [[ ! -x /usr/sbin/logrotate ]]; then
+    exit 0
+fi
+
 LOG=/var/log/logrotate.log
 echo >> ${LOG}
 echo "################################################" >> ${LOG}
 echo "[$(date --rfc-3339=seconds )]: Start Logrotating" >> ${LOG}
 /usr/sbin/logrotate  /etc/logrotate.conf >> ${LOG} 2>&1
+EXITVALUE=$?
+if [ $EXITVALUE != 0 ]; then
+    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
+fi
 echo "[$(date --rfc-3339=seconds )]: End Logrotating" >> ${LOG}
+exit $EXITVALUE
index 4eb82857866aa7c0310be0b67f5437c8649283cf..9dad9ec534d3411ff004dedf5c4f73b5c3f0373b 100644 (file)
@@ -8,6 +8,9 @@ rotate 99
 # create new (empty) log files after rotating old ones
 create
 
+# use date as a suffix of the rotated file
+dateext
+
 # uncomment this if you want your log files compressed
 compress
 delaycompress
@@ -15,25 +18,4 @@ delaycompress
 # packages drop log rotation information into this directory
 include /etc/logrotate.d
 
-# no packages own wtmp, or btmp -- we'll rotate them here
-/var/log/wtmp {
-    missingok
-    monthly
-    create 0664 root utmp
-    rotate 12
-    dateext
-    dateformat -%Y-%m-%d
-    size 4M
-}
-
-/var/log/btmp {
-    missingok
-    monthly
-    create 0660 root utmp
-    rotate 12
-    dateext
-    dateformat -%Y-%m-%d
-    size 4M
-}
-
-# system-specific logs may be configured here
+# system-specific logs may be also be configured here.
index 0aa1ae1ade1842b8fb36182292e96a13a553a661..b6f82b4af6864045c05ab43a5a9f71aade1bd131 100644 (file)
@@ -3,5 +3,8 @@
     missingok
     monthly
     create 0660 root utmp
-    rotate 1
+    minsize 4M
+    rotate 12
+    dateext
+    dateformat -%Y-%m-%d
 }
index cc8a151e00befe3d6a4182e7f24705817facd631..fa9ca3892faed30c9039cb913bc7df4056ef1b26 100644 (file)
@@ -3,6 +3,8 @@
     missingok
     monthly
     create 0664 root utmp
-    minsize 1M
-    rotate 1
+    minsize 4M
+    rotate 12
+    dateext
+    dateformat -%Y-%m-%d
 }
diff --git a/systemd/system/logrotate.service.d/exec-script.conf b/systemd/system/logrotate.service.d/exec-script.conf
new file mode 100644 (file)
index 0000000..effc0ab
--- /dev/null
@@ -0,0 +1,4 @@
+[Service]
+ExecStart=/root/bin/logrotate
+
+# vim: filetype=dosini