From ff4d9c7617d20ea2451b23ae052d11002d8d59cc Mon Sep 17 00:00:00 2001 From: Ben Clark Date: Mon, 25 Sep 2017 11:54:18 +0100 Subject: [PATCH] Add Linux/MacOSX backup and restore instructions (#468) * Add Linux/MacOSX backup and restore instructions Signed-off-by: Ben Clark * Change to absolute path references Signed-off-by: Ben Clark --- installation/linux.md | 28 ++++++++++++++++++++++++++-- installation/macosx.md | 27 +++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/installation/linux.md b/installation/linux.md index fb3eaa002d..f08194e7f8 100644 --- a/installation/linux.md +++ b/installation/linux.md @@ -346,6 +346,29 @@ sudo yum install openhab2-2.1.0-1 #### Backup and Restore To make a backup of your openHAB 2 system, you need to retain your configuration and userdata files. +As of version 2.2.0, you can use openHAB's scripts for storing your configuration in a zip file. +By default, the script saves the zip file in `/var/lib/openhab2/backups` for automatic installs and `openhab2/backups` for manual installs. +You can change the default path by setting the $OPENHAB_BACKUPS environment variable. + +```shell +sudo $OPENHAB_RUNTIME/bin/backup +## OR ## +sudo $OPENHAB_RUNTIME/bin/backup /path/to/backups/folder/myBackup.zip +``` + +To restore from these generated files: + +```shell +sudo $OPENHAB_RUNTIME/bin/restore $OPENHAB_BACKUPS/myBackup.zip +``` + +If you're unsure how to use the above files, just use `--help` or `-h`: + +```shell +$OPENHAB_RUNTIME/bin/backup --help +``` + +Otherwise, you may do this manually by: ```shell # stop openhab instance (here: systemd service) @@ -365,8 +388,8 @@ rm -rf "$BACKUPDIR/userdata/tmp" sudo systemctl start openhab2.service ``` -If you later want to restore settings, just replace them. -Maybe you will need to delete the existing data first. +If you later want to restore these manual settings, just replace them. +You may want to delete the existing data first. ```shell # stop openhab instance (here: systemd service) @@ -620,6 +643,7 @@ sudo rm /lib/systemd/system/openhab2.service | Site configuration | `/etc/openhab2` | `/opt/openhab2/conf` | | Log files | `/var/log/openhab2` | `/opt/openhab2/userdata/logs` | | Userdata like rrd4j databases | `/var/lib/openhab2` | `/opt/openhab2/userdata` | +| Backups folder | `/var/lib/openhab2/backups` | `/opt/openhab2/backups` | | Service configuration | `/etc/default/openhab2` | (not preconfigured) | ## Viewing Log Messages diff --git a/installation/macosx.md b/installation/macosx.md index c1c1a71b0c..8202e13152 100644 --- a/installation/macosx.md +++ b/installation/macosx.md @@ -133,3 +133,30 @@ Assuming the openHAB directory is in `~/openhab` simply run the following comman cd ~/openhab sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/openhab/openhab-distro/master/distributions/openhab/src/main/resources/bin/update)" -- 2.1.0 ``` + +## Backup and Restore + +To make a backup of your openHAB 2 system, you need to retain your configuration and userdata files. +As of version 2.2.0, you can use openHAB's scripts for storing your configuration in a zip file. From the terminal: +By default, the script saves the zip file in `/var/lib/openhab2/backups` for automatic installs and `openhab2/backups` for manual installs. +You can change the default path by setting the $OPENHAB_BACKUPS environment variable. + +```shell +sudo $OPENHAB_RUNTIME/bin/backup +## OR ## +sudo $OPENHAB_RUNTIME/bin/backup /path/to/backups/folder/myBackup.zip +``` + +To restore from these generated files: + +```shell +cd $OPENHAB_HOME + +sudo $OPENHAB_RUNTIME/bin/restore $OPENHAB_BACKUPS/myBackup.zip +``` + +If you're unsure how to use the above files, just use `--help` or `-h`: + +```shell +$OPENHAB_RUNTIME/bin/backup --help +```