Aggiunto compressione file di log dei driver

This commit is contained in:
lejubila
2019-06-23 12:44:33 +02:00
parent 9d9ef42679
commit aa12f5a8a5
2 changed files with 11 additions and 0 deletions

View File

@@ -1,3 +1,6 @@
# 0.5.12.1 - 23/06/2019
- Added zip log drver file when exceeding the size limit
# 0.5.12 - 13/11/2018
- Fixed a bug that prevented the publication of the mqtt topic for each event
- Fixed a bug on openweathermap driver which in some cases causes a malformation of the json status and prevented communication with piGardenWeb

View File

@@ -299,6 +299,14 @@ function log_write {
fi
fi
if [ -e "$LOG_OUTPUT_DRV_FILE" ]; then
local actualsize=$($WC -c <"$LOG_OUTPUT_DRV_FILE")
if [ $actualsize -ge $LOG_FILE_MAX_SIZE ]; then
$GZIP $LOG_OUTPUT_DRV_FILE
$MV $LOG_OUTPUT_DRV_FILE.gz $LOG_OUTPUT_DRV_FILE.`date +%Y%m%d%H%M`.gz
fi
fi
echo -e "`date`\t\t$1" >> $LOG_FILE
}