Upgrade DPA on Linux Script

I've only just started working with Database Performance Analyzer (DPA) running on Linux, but I do have to say that I'm digging it.  That is until I had to do my first upgrade.  It wasn't a difficult task by any means.  Unlike the Windows installation, it installs all the necessary files in a separate folder (by design) and you need to copy files from the old install folder to the new install folder. The process is clearly outlined in Upgrade DPA on Linux (solarwinds.com), but I'm a fan of scripting, so I decided to write something to automate the process.

You can run this script AFTER you've installed your new version, but before you've stopped the old one.  I've tested it a few times on two different versions of Linux (one RPM-based and the other DEB-based). As always, please take a snapshot/backup of both your DPA server and your repository database before performing any upgrade.

# --BEGIN--
####
# Inspired by: https://documentation.solarwinds.com/en/success_center/dpa/content/dpa-upgrade-dpa-on-linux.htm
####

#### Define your old and new DPA paths as variables
# typically '/home/solarwinds/dpa_##_##_##' but change as necessary
export OldDpaHome=/var/opt/solarwinds/dpa_2021_1_889
export NewDpaHome=/var/opt/solarwinds/dpa_2021_3_7353

# Stop old DPA Services
sudo sh $OldDpaHome/shutdown.sh

# Copy necessary configuration, licensing, and log files
sudo cp -Rpv $OldDpaHome/iwc/tomcat/conf $NewDpaHome/iwc/tomcat
sudo cp -Rpv $OldDpaHome/iwc/tomcat/ignite_config $NewDpaHome/iwc/tomcat
sudo cp -Rpv $OldDpaHome/iwc/tomcat/licensing $NewDpaHome/iwc/tomcat
sudo cp -Rpv $OldDpaHome/iwc/tomcat/logs $NewDpaHome/iwc/tomcat

# Start new DPA Services
sudo sh $NewDpaHome/startup.sh

# Optionally remove the previous installation (remove the # from the beginning)
# sudo rm -Rf $OldDpaHome

# Remove the path variables
unset OldDpaHome
unset NewDpaHome

# --END--

You can just run these commands in sequence and your new version should have all the settings (including custom HTTP/HTTPS ports).