mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-12-28 15:31:37 +00:00
24 lines
478 B
Bash
Executable File
24 lines
478 B
Bash
Executable File
#!/bin/bash
|
|
|
|
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
|
|
|
|
# We should not exit
|
|
exit 1
|