Synology Photo Station backup script

How to backup PhotoStation to another volume or another Synology machine

Create a shell script for the backup

vi ~/bin/photostation-backup.sh

Backup into another volume

  1. Create db dump
  2. rsync to another volume
#!/bin/bash
sudo pg_dump photo -U postgres > /volume1/photo/photo.sql

rsync -av --delete --progress --exclude '@eaDir' "/volume1/photo/" /volume2/photo_backup/
rsync -av --delete --progress --exclude '@eaDir' "/volume1/homes/ufnec/" /volume2/backup/ufnec/

Backup into another synology

  1. Create db dump
  2. rsync to another Synology
#!/bin/bash
sudo pg_dump photo -U postgres > /volume1/photo/photo.sql

rsync -avP -e "/usr/bin/ssh -v -i /ufnec/.ssh/id_rsa" /volume2/photo/ [email protected]:/volume1/NAS_BACKUP/ds1815/photo
rsync -avP -e "/usr/bin/ssh -v -i /ufnec/.ssh/id_rsa" /volume2/homes/ufnec/ [email protected]:/volume1/NAS_BACKUP/ds1815/ufnec
chmod 700 ~/bin/photostation-backup.sh

Schedule the script with cron job.

Posted in Development | Tagged , , , , | Leave a comment

Rsync over SSH with key

Create a new ssh key pair:

ssh-keygen -t rsa -b 2048 -f ufnec-rsync-key

Move the public key to remote server

scp ufnec-rsync-key.pub [email protected]:/home/ufnec


Add the public key to the authorized_key on the remote server:

ssh -l ufnec 192.168.3.8
cat ufnec-rsync-key.pub >> .ssh/authorized_keys

Test the connection:

ssh -l ufnec -i ~/.ssh/ufnec-rsync-key 192.168.3.8

You should not be prompted for a password.

Test the synchronization:

rsync --progress -avP -e "/usr/bin/ssh -i /home/ufnec/.ssh/ufnec-rsync-key" /home/ufnec/photo/ [email protected]:/home/ufnec/photo/
Posted in Development | Tagged , , | Leave a comment