Backup/Restore scripts for Linux and MacOS

Thank you for the reply, Thomas

I’m on MacOS and I just want to upgrade. I only have configurations within openHAB, mainly in Paper IU and HabPanel, but also some in persistence.

I will look in the thread for upgrade issues to see if I manage to solve it. Otherwise restoring my configurations seems so simple that I might as well install 2.2 from scratch.

What I meant with the new scrips in 2.2 was if I would be able to follow the instruction for restoring in 2.1 to restore a 2.1 backup in 2.2. I’m not sure if I understood how this should be done from your reply. How do I backup my 2.1 files independently in 2.2 backup/restore functionality?

Thanks

I don’t know the paths within MacOS, you’ll have to see in the sources what paths there are - or somebody here could help you.
there are basically two main directories, you must backup:

  • OPENHAB_USERDATA: that’s where your UI-related configuration is held
  • OPENHAB_CONF: that’s where your own items, sitemaps and stuff is Held
    be sure, you have both in you backup and after having switched to 2.2 that’s where you should restore them.

Thanks again!

There’s a small typo in the backup script:

When running:

    echo "Set $OPENHAB_BACKUPS to change the default backup directory."
    echo "Set $OPENHAB_BACKUPS_TEMP to change the default backup temporary directory."

You’ll see the environment variables’ value, no their names. The dollar sign should be escaped:

    echo "Set \$OPENHAB_BACKUPS to change the default backup directory."
    echo "Set \$OPENHAB_BACKUPS_TEMP to change the default backup temporary directory."

I’d probably report the current values of these environment variables, so I’d recommend rewriting those lines as follows:

    echo "Default backup directory: '$OPENHAB_BACKUPS'"
    echo "Set \$OPENHAB_BACKUPS to change the default backup directory."
    echo "Default backup temporary directory: '$OPENHAB_BACKUPS_TEMP'"
    echo "Set \$OPENHAB_BACKUPS_TEMP to change the default backup temporary directory."

When invoking, you should run it as root:

[17:43:16] openhabian@openHABianPi:/usr/share/openhab2$ sudo ./runtime/bin/backup --full

@shutterfreak, rather than in the forum, something like this should be reported in GH. The backup/restore scripts are in openhab-distro, which is linked to in the OP. You may want to consider submitting a PR too… this one wouldn’t even need an IDE, and could be done completely through GH.

Instead of escapes, brackets should be used, e.g. echo "Set ${OPENHAB_BACKUPS} to change the default backup directory."

I hope I did it correctly: Issue 894: [backup/restore] unescaped environment variables

2 Likes