openHAB Backup
Last modified by Normann P. Nielsen on 2025/12/12 15:15
Even though openHAB has a build-in backup system, as described inĀ openHAB, I have found out that the backup for sure is not complete (at LEAST the addons folder is not backed up).
So I made a short story alternative backup (on Ubuntu LTS), before testing stuff etc:
#!/bin/bash
now=`date +"%Y_%d_%m"`
cd /opt/openhab/
tar -cvzf /home/bnp/openhab-etc-$now.tgz /opt/openhab/*
now=`date +"%Y_%d_%m"`
cd /opt/openhab/
tar -cvzf /home/bnp/openhab-etc-$now.tgz /opt/openhab/*
Or, alternate as (with nice openHAB shutdown first):
#!/bin/bash
now=`date +"%Y_%d_%m"`
docker stop openhab
cd /opt/openhab/
tar -cvzf /home/bnp/openhab-etc-$now.tgz /etc/openhab2/*
docker start openhab
now=`date +"%Y_%d_%m"`
docker stop openhab
cd /opt/openhab/
tar -cvzf /home/bnp/openhab-etc-$now.tgz /etc/openhab2/*
docker start openhab