Now I set up automated backups of my working directory, so that every 3 hours my computer checks whether I modified the files in the directory, and if so uploads the modified files to the server, all thanks to rsync. In order for you to be able to follow the method I used you need: any SSH server (to which you will backup), your computer running OS X 10.6 (though this should work on older versions of OS X as well).
1. In order for rsync to be able to run in the background and automatically, you will need to setup up public keys for your computer and your SSH account as done here: http://www.ece.uci.edu/~chou/ssh-key.html
2. You need to create a shell script that calls rsync to backup your directory over to the server.
I call my script 'backup' and it looks like this:
#!/bin/sh
rsync -qr /Users/maks/Documents/Spring2011/ Maksim@ssh_server.domain.edu:S11Backup
2b. Move this script to /usr/local/bin/backup
2c. Make the script executable by issuing the command chmod u+x backup
Note: You may need to manually mkdir S11Backup on your SSH server.
3. In ~/Library/LaunchAgents/ make the file backup.plist (touch backup.plist), this is the file where you specify when your backup script should be run. Mine looks like this, copy and modify the 'Label' string's key as necessary:
Label
local.maks.daily_backup
OnDemand
LowPriorityIO
Nice
12
ProgramArguments
/usr/local/bin/backup
StartCalendarInterval
Hour
3
Minute
0
4. Issue the the command
launchctl load ~/Library/LaunchAgents
5. You're done! Now every 3 hours your backup script will be run by launchd. To verify that your script is loaded you can execute
launchctl list | grep makswhere you should replace 'maks' with a part or the whole of the key you used for 'Label' in step 3.