How to update OH2 on Synology?

Hi,
If that can help you, here is the script that I’m using to upgrade my OH2 on synology DSM6 to the latest snapshot.
This script is saved in my public/OpenHAB2 folder (where addons & conf directories are)

The steps are quite simple:

  1. Stop Openhab2 package

  2. Run the sh script as root user

  3. Start Openhab2 package

PUBLIC_CONF="/volume1/public/OpenHAB2/conf"
PUBLIC_ADDONS="/volume1/public/OpenHAB2/addons"
SYNOPKG_PKGDEST="/volume1/@appstore/OpenHAB2"


# backup current installation with settings
TIMESTAMP=`date +%Y%m%d_%H%M%S`;
sudo mv ${SYNOPKG_PKGDEST} /${SYNOPKG_PKGDEST}-backup-$TIMESTAMP

# download new version (please replace URL)
cd /tmp
wget https://openhab.ci.cloudbees.com/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab-online/target/openhab-online-2.0.0-SNAPSHOT.zip
sudo 7z x openhab-online-2.0.0-SNAPSHOT.zip -o${SYNOPKG_PKGDEST}
rm openhab-online-2.0.0-SNAPSHOT.zip

# restore configuration and userdata

#sudo cp -arv /volume1/@appstore/OpenHAB2-backup-$TIMESTAMP/conf /volume1/@appstore/OpenHAB2/
sudo cp -arv ${SYNOPKG_PKGDEST}-backup-$TIMESTAMP/userdata ${SYNOPKG_PKGDEST}/

#if configdir exists in public folder -> create a symbolic link
  if [ -d ${PUBLIC_CONF} ]; then
    rm -r ${SYNOPKG_PKGDEST}/conf
    ln -s ${PUBLIC_CONF} ${SYNOPKG_PKGDEST}
  fi

  #if public addons dir exists in public folder -> create a symbolic link
  if [ -d ${PUBLIC_ADDONS} ]; then
    rm -r ${SYNOPKG_PKGDEST}/addons
    ln -s ${PUBLIC_ADDONS} ${SYNOPKG_PKGDEST}
  fi

# fix permissions
sudo chown -hR openhab2:users ${SYNOPKG_PKGDEST}

BUT be aware that since a few days, the OH2 folder structure has changed a bit and I’ve NOT validated this script with the new folders structure. So let’s say that the script is fine with OH2B4 and previous :wink: