Even though openHAB has a build-in backup system, as described in openHAB#Backup, 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:

openhab-tar-backup.sh
#!/bin/bash

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):

openhab-tar-backup.sh
#!/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

Meet me at