Hi all,
Many people have asked for a simple way of backing up a configuration in a zip file, and a similarly simple way of restoring the configuration from that zip file.
From version 2.2 onward, openHAB will contain its own backup
and restore
scripts. These can be found in $OPENHAB_HOME/runtime/bin/
.
For users of the Linux packages, and openHABian, simply use the openhab-cli
commands.
Backup
Running this script will store all of the configurables made in paperUI or through textual configuration. It will attempt to backup the list of installed addons and bindings, and the settings for those bindings too.
cd $OPENHAB_HOME
./runtime/bin/backup ## Creates a backup file in the default location with a timestamp.
./runtime/bin/backup /opt/backups/myconfig.zip ## Creates a backup file in the specified location.
./runtime/bin/backup --help ## Brings up the help information
The default path to store the zip files in is in $OPENHAB_HOME/backups/
(/var/lib/openhab2/backups
for apt/yum users). You can change this default path by specifying the $OPENHAB_BACKUPS
environment variable (again use /etc/default/openhab2
if you’re using apt/yum)
Restore
The restore script restores a zip file created using process above and uses it to completely replace your openHAB configuration. Any newer changes that weren’t in the backup get removed.
*Note: This will not backup the runtime folders. If you’re trying to repair openHAB, it’s best to download a new instance, and then try the restore script to load your configuration.
cd $OPENHAB_HOME
./runtime/bin/restore /opt/backups/myconfig.zip ## Restores the openHAB config from the specified zipfile
./runtime/bin/restore --help ## Brings up the help information
Source
You can find the source files at https://github.com/openhab/openhab-distro/tree/master/distributions/openhab/src/main/resources/bin
As always, you should checkout the documentation for the latest instructions on how to use them. Let us know if you have any issues!