Scheduled Backups from Remote Locations#
As poweruser, you may have different servers out there which send their backups to a centralized backup location – in this example, a Synology NAS. The file transfers can be done by ftp, sftp, scp, nfs or another supported protocol.
In case you want to safe energy costs, it possible to enable the power safe mode which turns the system (as well as the HDDs) in standby mode. It can be waked-up by accessing the web-interface or some other file services, but this will take around 30-60s! In most cases, this behaviour will cause a timeout or connection refused error in your backup scripts. To prevent this, you can wake up your NAS before running the backup tasks. The following script tries to access the Web-Interface (DSM) on port 80 for a several times and returns 0 as exit code in case a valid response is returned by the remote server.
# Synology NAS Wake-up
# hostname/ip set ?
if [ -z "$1" ]; then
echo "Usage: synology_wakeup.sh <hostname>"
# get the server response. 5 connection tries with 10s delay -> 200s wait
serverResponse=$(wget --quiet --max-redirect=0 --retry-connrefused --timeout=20 --wait=10 --tries 5 --server-response -O /dev/null $1 2>&1)
# http detection pattern (response will be empty on con_refused)
# server online ?
if [[ $serverResponse =~ $detectionPattern ]] ; then
Just run the script by passing the ip addess/hostname to it. On error (non responding nas) the script will return the exit code 1.
# your backup/pre backup script
# wakeup your NAS by its IP/Hostname
# successfull ?
if [ $? -ne 0 ]; then
echo "ERROR - Synology NAS seems to be offline!"