Commit b77b8ca1 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Initial commit

parents
all: logrotate-conf
tar xf logrotate-3.15.0.tar.xz
cd logrotate-3.15.0 && ./configure --prefix=/usr
$(MAKE) -C logrotate-3.15.0
$(MAKE) -C logrotate-3.15.0 test
$(MAKE) -C logrotate-3.15.0 install
rm -rf logrotate-3.15.0
echo "$$LOGROTATE_CONF" > /etc/logrotate.conf
chmod -v 0644 /etc/logrotate.conf
mkdir -p /etc/logrotate.d
@echo "$$LOGROTATE_TIMER" > /lib/systemd/system/logrotate.timer
@echo "$$LOGROTATE_SERVICE" > /lib/systemd/system/logrotate.service
systemctl enable logrotate.timer
logrotate-conf:
define LOGROTATE_CONF
# Begin of /etc/logrotate.conf
# Rotate log files weekly
weekly
# Don't mail logs to anybody
nomail
# If the log file is empty, it will not be rotated
notifempty
# Number of backups that will be kept
# This will keep the 2 newest backups only
rotate 2
# Create new empty files after rotating old ones
# This will create empty log files, with owner
# set to root, group set to sys, and permissions 644
create 0664 root sys
# Compress the backups with gzip
compress
# No packages own lastlog or wtmp -- rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}
/var/log/lastlog {
monthly
rotate 1
}
# Some packages drop log rotation info in this directory
# so we include any file in it.
include /etc/logrotate.d
# End of /etc/logrotate.conf
endef
export LOGROTATE_CONF
logrotate-timer:
define LOGROTATE_TIMER
[Unit]
Description=Run log rotation periodically
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target
endef
export LOGROTATE_TIMER
logrotate-service:
define LOGROTATE_SERVICE
[Unit]
Description=Rotate logs
[Service]
Type=simple
ExecStart=/usr/sbin/logrotate /etc/logrotate.conf
endef
export LOGROTATE_SERVICE
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment