Shell VPS Backup Script

This script uses rsync and ssh keys over ssh to backup remote server with anacron, it should work with cron too, but it haven’t been tested.


#!/bin/sh
#Script for VPS back ups

#This is for the desktop notification on Ubuntu
notify-send -i drive-multidisk Rsync "VPS Backup Started"

#This is for the reallusion VPS
rsync -e "ssh -i /home/user/.ssh/id_rsa.2 -p 104" -rtv --delete root@domain.com:/home /mnt/DATA-L/backups
rsync -e "ssh -i /home/user/.ssh/id_rsa.2 -p 104" -rtv --delete root@domain.com:/etc /mnt/DATA-L/backups
rsync -e "ssh -i /home/user/.ssh/id_rsa.2 -p 104" -rtv --delete root@domain.com:/var/log /mnt/DATA-L/backups
rsync -e "ssh -i /home/user/.ssh/id_rsa.2 -p 104" -rtv --delete root@domain.com:/var/mail /mnt/DATA-L/backups
rsync -e "ssh -i /home/user/.ssh/id_rsa.2 -p 104" -rtv --delete root@domain.com:/var/backups /mnt/DATA-L/backups

#This is for the desktop notification on Ubuntu
notify-send -i drive-multidisk Rsync "VPS Backup Finished"