Skip to content

lingyinsam/Synology_Config_Backup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Synology Config Backup

Backup and export your Synology DSM configuration.

Donate committers.top badge

Description

This is a bash script to backup a Synology's System Config, and optionally copy it via SCP to another server.

Works on DSM 7 and DSM 6

What the script does:

  • Gets your Synology's hostname and the date for use in the backup filename.
    • The Synology's hostname is included in the backup's filename in case you have multiple Synology's.
  • Checks that the script is running as root.
  • Checks that your specified backup location exists.
  • Exports the system config to your specified folder.
  • If REMOTE_BACKUP=yes copies the backup to the specified remote server.

Example of the backup's auto-generated filename: DISKSTATION_2022-11-07_0600.dss

Download the script

  1. Download the latest version Source code (zip) from https://github.com/007revad/Synology_Config_Backup/releases
  2. Save the download zip file to a folder on the Synology.
  3. Unzip the zip file.

Settings

You need to set TARGET_DIR= near the top of the script (below the header). Set it to the location where you want the backup saved to.

You also need to set REMOTE_BACKUP= to yes if you want to copy the backup to a remote server.

For example:

TARGET_DIR="/volume1/Backups/NAS_System_Backups/DiskStation"
REMOTE_BACKUP=yes

Extra settings for copying the backup to a remote server

If you set REMOTE_BACKUP=yes you also need to set the REMOTE_PORT, REMOTE_IP, REMOTE_DIR, LOCAL_USER and REMOTE_USER to suit your setup.

For example:

REMOTE_PORT=22
REMOTE_IP=192.168.0.100
REMOTE_DIR="/volume1/Backups/NAS_System_Backups/DiskStation"
LOCAL_USER=Bob
REMOTE_USER=Bob

If you set REMOTE2_BACKUP=yes you also need to set the REMOTE2_PORT, REMOTE2_IP, REMOTE2_DIR, LOCAL2_USER and REMOTE2_USER to suit your setup.

For example:

REMOTE2_PORT=22
REMOTE2_IP=192.168.0.111
REMOTE2_DIR="/volume1/Backups/NAS_System_Backups/DiskStation"
LOCAL2_USER=Bob
REMOTE2_USER=Ted

Requirements

If you want to schedule the script to run unattended, and have the script copy the backup to another server you need to have SSH keys setup so SCP can access the remote server without you entering the user's password.

See https://blog.golimb.com/2020/10/03/synology-ssh-key-authentication/ for steps on setting up SSH key authentication.

Note: Due to some of the commands used this script needs to be run as root, or be scheduled to run as root.

About

Backup and export your Synology DSM configuration.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%