Where to set path to backup directory

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

What I am doing wrong?

you can pass the target folder to openhab-cli, e.g.

openhab-cli /media/zyxel_backup/...

Yes I know this but about the long path I set the path in history, but the variable is not longer working in OH3

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.

Thanks @Wolfgang_S the file /etc/profile.d/openhab.sh was new for me.

I have done the following steps
Set variable in /etc/defaults/openhab to my own backup path like

OPENHHAB_BACKUPS=/media/zyxel_backup/backup/openhab/raspi442 

The variable ist set an looks OK I checked with printenv

printenv

OPENHHAB_BACKUPS=/media/zyxel_backup/backup/openhab/raspi442

but with openhab-cli info I get this


sudo openhab-cli info

Version:     3.1.0-SNAPSHOT (#2165)

User:        openhab (Active Process 651)
User Groups: openhab tty dialout audio bluetooth gpio

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

Variable is not taken from OH it is still /var/lib/openhab/backups

Has it something to do with the User and Group root:root

 OPENHAB_BACKUPS  | /var/lib/openhab/backups    | root:root

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.

Sorry my fault, it was so simple.
A typo in the variable OPENHHAB_BACKUPS=/media/zyxel_backup/backup/openhab/raspi442