Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

Easily and automatically backs up the files on your web host to your local computer.

Notifications You must be signed in to change notification settings

homebysix/website-rsync-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Website Rsync Backup

Easily and automatically backs up the files on your web host to your local computer. This script is meant to be executed once per day using cron.

Features

  • Backs up any files you choose from your web host to your local computer.
  • Each backup is placed into an individually datestamped folder for simplicity.
  • If a previous backup is found, the files are copied locally before rsync runs for increased efficiency.
  • Supports sending email and/or SMS alerts upon completion.
  • Works with many different web hosts. (Tested on MediaTemple and HostGator.)
  • Can back up multiple sites from different hosts all in the same run.
  • Easy to configure automatic daily runs using cron.

Requirements

  • Your web hosting account must allow SSH login.
  • You must have configured SSH keys to allow connection without a password prompt. (If you run this script as root, the SSH keys must be in the root user's home folder too.)
  • Your local computer must have rsync installed. (If you're on a Mac, I recommend using Brew to install a more recent version than the one that ships with OS X.)
  • Requires enough local disk space to hold three copies of your web host files. (Ideally more than that, of course.)

Instructions

  1. Edit the options in the WEBSITE SETTINGS and ALERT SETTINGS sections to suit your environment.
  2. Make the script executable using chmod +x.
  3. Run the script.

For automatic daily runs, add the script to the crontab. (Or if you're on a Mac, place the script in /etc/periodic/daily. Be sure to leave your Mac on.)

Known Issues

  • Could be more efficient with rsync by keeping the most recent version of the uncompressed backup, then doing an incremental rsync.

To Do / Roadmap

  • Dry-run mode that shows what will happen instead of actually doing it.
  • Version pruning, coming soon.

Acknowledgements

  • Thanks to @laurent22 for the logging and terminate trapping functions.

About

Easily and automatically backs up the files on your web host to your local computer.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages