How to automatically backup website via FTP to Synology NAS

Evotec has written a quite good step by step manual how to set-up a backup task into Synology DSM, you can see it here: https://evotec.xyz/how-to-backup-ftp-to-synology/
But his backup functions and principles – there are mistakes and here are the correct and fixed codes.

wget -m -nH ftp://USERNAME:PASSWORD@SERVER_IP/public_html/* -P /volume1/Private/BACKUP/www_automated_backups/temp
tar -zcvf /volume1/Private/BACKUP/www_automated_backups/backup-siteground-$(date +%Y-%m-%d-%H-%M-%S).tar.gz -C /volume1/Private/BACKUP/www_automated_backups/temp .
rm -rf /volume1/Private/BACKUP/www_automated_backups/temp/*

wget -nH is needed so all the server path before the chosen folder isn’t saved in our backup
Temp folder is needed because there will be put all the downloaded data
Note the “/volume1/” – that is a full path for my folder structure (not visible in file station), but without a correct full path this script won’t work.

-C changes the directory to the Temp one and “.” states to use all its content and not archiving the full path on the server.
rm -rf will clean out the temp folder so next time archive will be created from only again fresh downloaded files and only those.

 

Šis raksts ir publicēts un saistīts ar tematiem .