1.1 - logging fixes
This commit is contained in:
parent
668dd0c840
commit
e8236cc2b4
1 changed files with 11 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
scriptVersion="1.0"
|
scriptVersion="1.1"
|
||||||
scriptName="AutoConfig"
|
scriptName="AutoConfig"
|
||||||
|
|
||||||
log () {
|
log () {
|
||||||
|
@ -10,14 +10,19 @@ 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/$scriptName.txt" ]; then
|
if [ -f "/config/logs/$scriptName.txt" ]; then
|
||||||
find /config/logs -type f -name "$scriptName.txt" -size +5000k -delete
|
find /config/logs -type f -name "$scriptName.txt" -size +1024k -delete
|
||||||
sleep 0.01
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "/config/logs/$scriptName.txt" ]; then
|
||||||
touch "/config/logs/$scriptName.txt"
|
touch "/config/logs/$scriptName.txt"
|
||||||
exec &> >(tee -a "/config/logs/$scriptName.txt")
|
|
||||||
chmod 666 "/config/logs/$scriptName.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
|
||||||
|
|
Loading…
Reference in a new issue