logging optimizations
This commit is contained in:
parent
283640634a
commit
a71813bd92
1 changed files with 12 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
scriptVersion="2.3"
|
scriptVersion="2.4"
|
||||||
scriptName="Audio"
|
scriptName="Audio"
|
||||||
|
|
||||||
log () {
|
log () {
|
||||||
|
@ -9,15 +9,20 @@ 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/Audio.txt" ]; then
|
if [ -f "/config/logs/$scriptName.txt" ]; then
|
||||||
find /config/logs -type f -name "Audio.txt" -size +5000k -delete
|
find /config/logs -type f -name "$scriptName.txt" -size +1024k -delete
|
||||||
sleep 0.01
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "/config/logs/$scriptName.txt" ]; then
|
||||||
|
touch "/config/logs/$scriptName.txt"
|
||||||
|
chmod 666 "/config/logs/$scriptName.txt"
|
||||||
fi
|
fi
|
||||||
touch "/config/logs/Audio.txt"
|
|
||||||
exec &> >(tee -a "/config/logs/Audio.txt")
|
|
||||||
chmod 666 "/config/logs/Audio.txt"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
Loading…
Reference in a new issue