I upgradet from OH 2.5 to Version: 3.1.0-SNAPSHOT (#2165)
In OH 2.5 I have set the OPENHAB_BACKUPS variable in /etc/default/openhab2 to my NAS. OPENHAB_BACKUPS=/media/zyxel_backup/backup/openhab/raspi442 this was working without problem.
All Backup done with sudo openhab-cli backup was going to the right directory to on my NAS.
In OH3 this path is now not longer taken. (I used /etc/default/openhab)
I tried to set the variable manually in the shell export OPENHAB_BACKUPS=/media/zyxel_backup/backup/openhab/raspi442
With printenv it looks now OK I see the right path OPENHAB_BACKUPS=/media/zyxel_backup/backup/openhab/raspi44
Now I restarted openhab with sudo /bin/systemctl restart openhab.service and looked to the backup path with sudo openhab-cli info
Directories: Folder Name | Path | User:Group
----------- | ---- | ----------
OPENHAB_HOME | /usr/share/openhab | openhab:openhab
OPENHAB_RUNTIME | /usr/share/openhab/runtime | openhab:openhab
OPENHAB_USERDATA | /var/lib/openhab | openhab:openhab
OPENHAB_CONF | /etc/openhab | openhab:openhab
OPENHAB_LOGDIR | /var/log/openhab | openhab:openhab
OPENHAB_BACKUPS | /var/lib/openhab/backups | root:root
The path is still not used it still goes to /var/lib/openhab/
sudo openhab-cli backup
Using ‘/etc/openhab’ as conf folder…
Using ‘/var/lib/openhab’ as userdata folder…
Using ‘/usr/share/openhab/runtime’ as runtime folder…
Using ‘/var/lib/openhab/backups’ as backup folder…
Writing to '/var/lib/openhab/backups/openhab-backup-21_01_26-13_34_19.zip
have a look to the backup script that is called by openhab-cli. It contains:
## Set path variables
if [ -r /etc/profile.d/openhab.sh ]; then
. /etc/profile.d/openhab.sh
elif [ -r /etc/default/openhab ]; then
. /etc/default/openhab
fi
WorkingDir="$(cd "$(dirname "$0")" && cd ../.. && pwd -P)"
if [ -z "$OPENHAB_CONF" ]; then OPENHAB_CONF="$WorkingDir/conf"; fi
if [ -z "$OPENHAB_USERDATA" ]; then OPENHAB_USERDATA="$WorkingDir/userdata"; fi
if [ -z "$OPENHAB_BACKUPS" ]; then OPENHAB_BACKUPS="$WorkingDir/backups"; fi
if [ -z "$OPENHAB_RUNTIME" ]; then OPENHAB_RUNTIME="$WorkingDir/runtime"; fi
echo "Using '$OPENHAB_CONF' as conf folder..."
echo "Using '$OPENHAB_USERDATA' as userdata folder..."
echo "Using '$OPENHAB_RUNTIME' as runtime folder..."
So you can see the two files that are being used to set the variables:
/etc/profile.d/openhab.sh
/etc/default/openhab
This is taken from a debian installation. It might be different on docker but nevertheless the backup script should contain the file names where the variables are being set.
Does the backup script that you have on your system have the lines of code in that I posted earlier or does it look different ?
I don’t think that it’s related to the owner of /var/lib/openhab/backups nevertheless you can change the ownership of the directory as all directories including and below /var/lib/openhab are owned by openhab:openhab.