add function to delete logs older than 5 boots

This commit is contained in:
Alfonso Gamboa 2022-06-11 04:36:46 -07:00
parent 9138ba4a9c
commit 35d106a5c5

View File

@ -162,6 +162,15 @@ dmesg > $DMESG_LOG.log 2>&1
}
trim_logs() {
echo "Deleting logs older than 5 boots..."
find /opt/wz_mini/log -name '*log*' | while read file; do
[ "${file#/opt/wz_mini/log/*log.}" -gt 5 ] && rm -v "$file"
done
}
first_run_check
wait_sdroot
@ -559,6 +568,7 @@ touch /opt/wz_mini/tmp/.wz_user_firstrun
pkill -f dumpload #Kill dumpload so it won't waste cpu or ram gathering cores when something crashes
sysctl -w kernel.core_pattern='|/bin/false'
dmesg_log
trim_logs
sync;echo 3 > /proc/sys/vm/drop_caches