diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cba018..1af75f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/piGarden.sh b/piGarden.sh index 7469a51..741063e 100755 --- a/piGarden.sh +++ b/piGarden.sh @@ -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 }