mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Merge pull request #1370 from wtfo-guru/fix_truncate_logs
added missing mail logs, and firewalld log
This commit is contained in:
@@ -17,15 +17,15 @@ treshold=75 # %
|
||||
|
||||
logusage=$(df /var/log/ --output=pcent | tail -1 |cut -d "%" -f 1)
|
||||
if [ $logusage -ge $treshold ]; then
|
||||
# write to SD
|
||||
/usr/lib/armbian/armbian-ramlog write >/dev/null 2>&1
|
||||
# rotate logs on "disk"
|
||||
chown root.root -R /var/log.hdd
|
||||
/usr/sbin/logrotate --force /etc/logrotate.conf
|
||||
# truncate
|
||||
/usr/bin/find /var/log -name '*.log' -or -name '*.xz' -or -name 'lastlog' -or -name 'messages' -or -name 'debug' -or -name 'syslog' | xargs truncate --size 0
|
||||
/usr/bin/find /var/log -name 'btmp' -or -name 'wtmp' -or -name 'faillog' | xargs truncate --size 0
|
||||
# remove
|
||||
/usr/bin/find /var/log -name '*.[0-9]' -or -name '*.gz' | xargs rm >/dev/null 2>&1
|
||||
|
||||
# write to SD
|
||||
/usr/lib/armbian/armbian-ramlog write >/dev/null 2>&1
|
||||
# rotate logs on "disk"
|
||||
chown root.root -R /var/log.hdd
|
||||
/usr/sbin/logrotate --force /etc/logrotate.conf
|
||||
# truncate
|
||||
/usr/bin/find /var/log -name '*.log' -or -name '*.xz' -or -name 'lastlog' -or -name 'messages' -or -name 'debug' -or -name 'syslog' | xargs truncate --size 0
|
||||
/usr/bin/find /var/log -name 'btmp' -or -name 'wtmp' -or -name 'faillog' -or -name 'firewalld' | xargs truncate --size 0
|
||||
/usr/bin/find /var/log -name 'mail.err' -or -name 'mail.info' -or -name 'mail.warning' | xargs truncate --size 0
|
||||
# remove
|
||||
/usr/bin/find /var/log -name '*.[0-9]' -or -name '*.gz' | xargs rm >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user