2.5 - logging fixes

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

View file

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