Sometimes you may want to backup/synchronize data from a remote server to your
local QNAP server. This can be done fairly easily and efficiently
using the already installed rsync command.
Note: You need to have set up a passwordless SSH login from your
QNAP to your remote host for the below script to work.
In addition the script below will send an eMail once it finishes
it’s run. To get the script going on your machine, simply adapt the
variables to point to your local directories and supply a valid eMail
address (can be the same for FROM and TO).
As any operating system upgrade will otherwise delete your backup
script you need to place it onto the share disk itself, as this will
prevent the script of being deleted during an upgrade operation (I suggest
stuffing it into a Gist on Github as well ).
I suggest putting the script in the following location if you have set
up a RAID 5 array (the location may be slightly different for you setup)
Executing A Daily backup
Once the script is in it’s place you need to configure a cron job
so it will be executed let’s say once a day at 5 AM. To do so simply
type crontab -e into your terminal as admin user and add a line like
this at the end of the file.