mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-12-24 13:38:11 +00:00
Prevent some logs from growing forever
This commit is contained in:
parent
3c81c93f20
commit
af95dc7d22
|
@ -4,7 +4,18 @@ set -e
|
|||
set -x
|
||||
|
||||
while true; do
|
||||
# Rotate logs
|
||||
logrotate /etc/logrotate.conf
|
||||
|
||||
# Check for any "lost" logs that are growing too large
|
||||
LARGE_FILE_COUNT=$(find /var/log/ -type f -size +10M | wc -l)
|
||||
if [ "$LARGE_FILE_COUNT" -gt "0" ]; then
|
||||
# Delete the files and restart syslog
|
||||
find /var/log/ -type f -size +10M | sudo xargs rm -f
|
||||
systemctl restart syslog
|
||||
fi
|
||||
|
||||
# Sleep
|
||||
sleep 10m
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user