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'
#!/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
# 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
# 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.
missingok
monthly
create 0660 root utmp
- rotate 1
+ minsize 4M
+ rotate 12
+ dateext
+ dateformat -%Y-%m-%d
}
missingok
monthly
create 0664 root utmp
- minsize 1M
- rotate 1
+ minsize 4M
+ rotate 12
+ dateext
+ dateformat -%Y-%m-%d
}
--- /dev/null
+[Service]
+ExecStart=/root/bin/logrotate
+
+# vim: filetype=dosini