Wiki source code of openHAB Backup
Version 1.1 by Normann P. Nielsen on 2026/11/15 15:42
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | Even though openHAB has a build-in backup system, as described inĀ [[openHAB>>Main.information-technology.openhab]], I have found out that the backup for sure is not complete (at LEAST the addons folder is not backed up). |
| 2 | |||
| 3 | So I made a short story alternative backup (on Ubuntu LTS), before testing stuff etc: | ||
| 4 | |||
| 5 | |||
| 6 | {{code language="openhab-tar-backup.sh"}} | ||
| 7 | #!/bin/bash | ||
| 8 | |||
| 9 | now=`date +"%Y_%d_%m"` | ||
| 10 | |||
| 11 | cd /opt/openhab/ | ||
| 12 | tar -cvzf /home/bnp/openhab-etc-$now.tgz /opt/openhab/* | ||
| 13 | {{/code}} | ||
| 14 | |||
| 15 | |||
| 16 | |||
| 17 | Or, alternate as (with nice openHAB shutdown first): | ||
| 18 | |||
| 19 | |||
| 20 | {{code language="openhab-tar-backup.sh"}} | ||
| 21 | #!/bin/bash | ||
| 22 | |||
| 23 | now=`date +"%Y_%d_%m"` | ||
| 24 | |||
| 25 | docker stop openhab | ||
| 26 | cd /opt/openhab/ | ||
| 27 | tar -cvzf /home/bnp/openhab-etc-$now.tgz /etc/openhab2/* | ||
| 28 | docker start openhab | ||
| 29 | {{/code}} |