Option for compact the database
etofi opened this issue · 2 comments
Is it possible to add the following two environment variables to make the database smaller?
-
CONFIG_COMPACT_CRON
Specifies in the normal cronjob format how often the compression should be executed (for example "* * 1 * *")
If there is nothing in it, there is no compression. -
CONFIG_COMPACT_KEEP_MONTH
Number of months you want to keep data (for example "12")
Then at the time defined in the variable CONFIG_COMPACT_CRON a script has to be executed which does the following one after the other.
- Stop CCU-Historian
- java -jar /opt/ccu-historian/ccu-historian.jar -clean $(date -d="CONFIG_COMPACT_KEEP_MONTH month ago" +%Y-%m-%d)
- java -jar /opt/ccu-historian/ccu-historian.jar -recalc
- java -jar /opt/ccu-historian/ccu-historian.jar -compact
- Start CCU-Historian
This would be great.
This seems indeed very useful.
I will look into this as soon as I have some spare time 👍
I think the main problem would be 1. Stop CCU-Historian
as it would stop the container as well.
But may be I could add CONFIG_KEEP_MONTHS
only so it can be executed (-clean
, -recalc
, -compact
) before the start of CCU-Historian.