From bd10be4f63e93609045d577c0bce90ef508b97e5 Mon Sep 17 00:00:00 2001 From: Christopher Young Date: Fri, 17 Nov 2017 11:12:20 -0500 Subject: [PATCH] Add logrotate conf. Keep two days of logs. Run logrotate on boot. --- image/logrotate.conf | 32 ++++++++++++++++++++++++++++++++ image/mkimg.sh | 3 +++ image/rc.local | 7 +++++++ selfupdate/makeupdate.sh | 1 + selfupdate/update_footer.sh | 3 +++ 5 files changed, 46 insertions(+) create mode 100644 image/logrotate.conf diff --git a/image/logrotate.conf b/image/logrotate.conf new file mode 100644 index 00000000..073056d0 --- /dev/null +++ b/image/logrotate.conf @@ -0,0 +1,32 @@ +# see "man logrotate" for details +# rotate log files weekly +daily + +# keep 2 days worth of backlogs +rotate 2 + +# create new (empty) log files after rotating old ones +create + +# uncomment this if you want your log files compressed +compress + +# 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 1 +} + +/var/log/btmp { + missingok + monthly + create 0660 root utmp + rotate 1 +} + +# system-specific logs may be configured here diff --git a/image/mkimg.sh b/image/mkimg.sh index 15b3c58f..6295a20a 100755 --- a/image/mkimg.sh +++ b/image/mkimg.sh @@ -61,6 +61,9 @@ chmod 755 mnt/usr/sbin/sdr-tool.sh #ping udev cp -f 99-uavionix.rules mnt/etc/udev/rules.d +#logrotate conf +cp -f logrotate.conf mnt/etc/logrotate.conf + #fan/temp control script #remove old script rm -rf mnt/usr/bin/fancontrol.py diff --git a/image/rc.local b/image/rc.local index 56aecd79..565c09ef 100755 --- a/image/rc.local +++ b/image/rc.local @@ -17,6 +17,13 @@ if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" fi + +# +# Rotate logs on boot. +# +/usr/sbin/logrotate /etc/logrotate.conf + + /usr/bin/stratux-screen.py start exit 0 diff --git a/selfupdate/makeupdate.sh b/selfupdate/makeupdate.sh index 01de5970..4d2387d9 100755 --- a/selfupdate/makeupdate.sh +++ b/selfupdate/makeupdate.sh @@ -39,6 +39,7 @@ cp image/stratux-wifi.sh work/bin/ cp image/rc.local work/bin/ cp image/dhcpd.conf work/bin/ cp image/interfaces work/bin/ +cp image/logrotate.conf work/bin #TODO: librtlsdr. cd work/ diff --git a/selfupdate/update_footer.sh b/selfupdate/update_footer.sh index e8d8af15..bfa67610 100755 --- a/selfupdate/update_footer.sh +++ b/selfupdate/update_footer.sh @@ -23,6 +23,9 @@ ln -fs /lib/systemd/system/stratux.service /etc/systemd/system/multi-user.target cp -f hostapd.conf /etc/hostapd/hostapd.conf cp -f hostapd-edimax.conf /etc/hostapd/hostapd-edimax.conf +#logrotate config +cp -f logrotate.conf /etc/logrotate.conf + #WiFi Hostapd ver test and hostapd.conf builder script cp -f stratux-wifi.sh /usr/sbin/