rsync is already installed on your Mac OS X system. With no software to install and no previous experience, you can configure simple, elegant backups from your mac in the true UNIX tradition.
Remember - we will write your commands or scripts for you so don't hesitate to ask.
Overview - Four Steps
1. You (or rsync.net Support) will create a backup script that backs up the Folders that are important on that system.
2. Then you will create an SSH key for secure, automated backups to our service.
3. Then you will run this script once to completion - that will be the initial backup.
4. After the initial backup is completed, you will schedule that very same script to run at the time(s) of your choosing.
The rsync Script
Your Mac OS X system has one or more directories that are valuable to you. This list usually starts with /Users, which contains all of the user home directories. Depending on your system and what you have installed, you may also include /etc or /opt.
Whatever the list is, simply email that list of directories you want backed up to rsync.net Support and ask them to create an rsync backup script for your mac.
That script will look something like this:
#!/bin/sh echo BEGIN `date` >> /var/log/backup.log /usr/bin/caffeinate -s /usr/bin/rsync -aH /Users user@rsync.net: >> /var/log/backup.log echo END `date` >> /var/log/backup.log
All we are doing in that script is backing up /Users. We insert a "BEGIN" and "END" line into a new file on your system named "/var/log/backup.log", which might be helpful for troubleshooting in the future. We also "caffeinate" the rsync command so that the backup will run to completion even if your system is scheduled to sleep while the backup is still running.
Again, just email rsync.net Support your list of directories and we will create this script for you
Create SSH Keys for Automated Backups
Make sure you are logged in as the user who will do the backups, and then open the Terminal Application and run:
# ssh-keygen -t rsa
When you hit 'enter' the output will be:
# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/username/.ssh/id_rsa): Just hit enter to accept the default
Enter passphrase (empty for no passphrase): Yes, hit enter for an EMPTY passphrase
Enter same passphrase again: Hit enter again to CONFIRM the EMPTY passphrase
Your identification has been saved in /Users/username/.ssh/id_rsa.
Your public key has been saved in /Users/username/.ssh/id_rsa.pub.
The key fingerprint is:
a7:a0:38:5c:8d:99:33:99:ea:54:b3:e3:3c:6b:a7:9f username@null-2.local
Now you have an SSH keypair for the user you are currently logged in as.
Upload your newly created public key using this command:
scp ~/.ssh/id_rsa.pub user@rsync.net:.ssh/authorized_keys
(of course, inserting your username and rsync.net hostname in place of "user@rsync.net")
Now quickly test that your key works:
ssh user@rsync.net ls
You should not be asked for a password when executing the above 'ls' command over ssh.
Running the Script
Once you have downloaded the script, you can run it for the very first time by simply double-clicking it in your Downloads directory.
When you run the script for the first time, it may take some time - perhaps even several hours - to complete. This is because you are uploading all of your data for the very first time to your rsync.net account.
After the initial upload, however, your backups will complete in much less time. Only the changes between backups will be sent after this initial upload is finished.
We do not schedule the backups at all until the initial backup has completed - otherwise, you might begin your next automated backup before the first one successfully finished.
Scheduling Your Backups
Do NOT schedule your backups until AFTER your initial backup completes - see "Running the Script", above.
There are three ways to schedule your rsync backups: Point and Click Simple with iCal, Power User Precision with launchd/plist, or "Get Off My Lawn" with crontab.
If you have never done this before, use the Point and Click Simple method, with iCal.
If you know what you are doing and you have a system that sometimes sleeps, use the launchd/plist method.
If we really should just get off your lawn, use the crontab method (this is our preferred method).
Point and Click, Simple Scheduling, with Calendar/iCal
Open up Calendar (your local Calendar - not your Google or sync'd Calendar) and choose "New Event" from the File menu.
The new event can be titled anything you like - for instance "rsync.net cloud backup".
You should select the start time you would like the backups to run at - perhaps something like 1am or 2am. The duration of the event is not important - you can leave it at the default of one hour.
Set the "repeat" setting to what you like, but presumably this is a daily backup so you should probably set it to "daily".
You will need to further modify the event as follows so that your new backup script is run at the time of the event:
a. under 'alert:' select 'Custom...'
b. The first dropdown should be changed from 'Message' to 'Open file'
c. It will then reveal a new dropdown named 'Calendar', click that and choose 'Other...', then...
d. find and select the script you downloaded (rsyncnet_backup.sh)
e. Change 'minutes before' to 'At time of event'
f. Click OK
Now your Calendar event has been created and will run at the time of your choosing.
NOTE: If your mac is asleep when the event occurs, it will NOT run, and will simply run when the computer is woken up. If you would like the event to run at the proper time regardless of whether the system is asleep or not then you need to enter System Preferences, open "Energy Saver", click the "Schedule" button in the lower right, and check the "start up or wake" box, then choose a time 10 minutes AFTER (yes, after) your job is scheduled to run. Now the system will wake up and see that a job was scheduled to run and will run it immediately.
Power User Precision with launchd/plist
First, generate a launchd plist for yourself using this link - just fill in the schedule (ex: min=5, hour=0, day of month=* would setup a job that runs daily at 5min after midnight local time), name of the job, path to your script and extras as you require. At the very least, you'll need to configure something in the schedule. Now click the green "Create .plist" button. You may also simply download a stock plist here.
Now, scroll down to "Manual Install" and paste in those three commands that have been generated for you, BUT add two lines to change the ownership and permissions of the file:
mkdir -p ~/Library/LaunchAgents ....
curl -o ~/Library/LaunchAgents ....
chown root:wheel ~/Library/LaunchAgents/...
chmod o-w ~/Library/LaunchAgents/...
launchctl load -w ....
If you think your mac might be asleep when the scheduled time for this backup arises, you can alter your power settings to wake the computer up 10 minutes AFTER (yes, after) your job is scheduled to run:
sudo pmset repeat wake MTWRFSU HH:MM:SS
If you want to power on a powered off system, you'd use this instead:
sudo pmset repeat wakeorpoweron MTWRFSU HH:MM:SS
Get Off My Lawn - I'm Using crontab
This is the method we prefer. Yes, crontab did NOT work well in Snow Leopard and possibly Lion, and yes, Apple has declared it obsolete and unsupported. However, we have found that in recent OS X releases, cron and crontab work exactly as you would expect them to.
The only problem is that cron jobs (unlike launchd plist jobs) do not reliably run themselves after a power off / sleep event. This means that we cannot recommend crontab scheduling on a mac unless it is a machine that is up and running at all hours and does not ever sleep. If you have a system that could be powered off periodically, or go to sleep, you should (unfortunately) use the launchd/plist method, above.
Enter the crontab with:
# crontab -e
and put in this job, which is the example script that you downloaded from rsync.net support, configured to run at midnight:
0 0 * * * /Users/username/Downloads/rsyncnet_backup.sh
Support
If you have any problems with this process, do not hesitate to email support@rsync.net - we will help you immediately, and have you up and running that same day.