1.1 - logging fixes

This commit is contained in:
RandomNinjaAtk 2023-07-19 14:42:56 +00:00 committed by GitHub
parent cda848a99b
commit 92880a6c6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,5 @@
#!/usr/bin/with-contenv bash
scriptVersion="1.0"
scriptVersion="1.1"
scriptName="UnmappedFilesCleaner"
log () {
@ -10,14 +10,19 @@ log () {
logfileSetup () {
# auto-clean up log file to reduce space usage
if [ -f "/config/logs/$scriptName.txt" ]; then
find /config/logs -type f -name "$scriptName.txt" -size +5000k -delete
sleep 0.01
find /config/logs -type f -name "$scriptName.txt" -size +1024k -delete
fi
if [ ! -f "/config/logs/$scriptName.txt" ]; then
touch "/config/logs/$scriptName.txt"
chmod 666 "/config/logs/$scriptName.txt"
fi
touch "/config/logs/$scriptName.txt"
exec &> >(tee -a "/config/logs/$scriptName.txt")
chmod 666 "/config/logs/$scriptName.txt"
}
# Create Log, start writing...
logfileSetup
exec &> >(tee -a "/config/logs/$scriptName.txt")
verifyConfig () {
#### Import Settings
source /config/extended.conf