I’ve played around with the following script to automatically update the duplicacy web edition and I’m sharing it here for anyone who would like to try something similar. The idea is to run it once a month or so as a cronjob. Note, however, that this is one of my first bash scripts and that I have not extensively tested this. So use at your own risk and feel free to comment and improve it.
Needless to say that you will need to adapt the paths in the script to fit your installation.
#!/bin/bash
current=`ls -t /usr/bin/ | grep -m 1 -E -o "duplicacy_web_linux_x64_[[:digit:]]\.[[:digit:]]\.[[:digit:]]"`
echo current version is "$current"
latest=`curl -s "https://duplicacy.com/download.html" | grep -E -o "https:\/\/acrosync\.com\/duplicacy-web\/duplicacy_web_linux_x64_[[:digit:]]\.[[:digit:]]\.[[:digit:]]" | grep -E -o "duplicacy_web_linux_x64_[[:digit:]]\.[[:digit:]]\.[[:digit:]]"`
echo latest version is "$latest"
if [ "$current" != "$latest" ]
then
echo "Update available"
echo "Downloading new version..."
wget https://acrosync.com/duplicacy-web/"$latest"
# ps aux | grep -c "/.duplicacy-web/bin/duplicacy"
# while [ ps aux | grep -c "/.duplicacy-web/bin/duplicacy" != "0" ]
# do
# echo "waiting for duplicacy jobs to finish"
# sleep 3600 &
# done
echo "Stopping duplicacy-web"
systemctl stop duplicacy
echo "Installing new version..."
mv "$latest" /usr/bin/
chmod 700 /usr/bin/"$latest"
ln -s -f /usr/bin/"$latest" /usr/bin/duplicacy-web
echo "Restarting duplicacy-web"
systemctl start duplicacy
echo "Done."
exit 0
else
echo "No update available"
fi
