Tuesday, May 25, 2010

Doing automatic backups

If you have a synchronizing service like Dropbox or Ubuntu One installed (I have both), it's fairly easy to set up automatic backups that can be later downloaded from the net if something wicked happens to your computer.

The solution is to set up scheduled Cron jobs that run automatically on selected times, such as:

50 12 * * * tar -czf /home/m/Dropbox/bup/Workshop.tar.gz /home/m/Workshop/

This command will create a compressed archive into under the 'Dropbox' folder named 'Workshop.tar.gz' from the contents of the folder 'Workshop' every day at 12:50. Naturally since the newly created archive is in the Dropbox folder, it will be uploaded to the Dropbox online storage seamlessly.

Scheduling syntax is as follows:

  1. * Minutes (0-59)
  2. * Hours (0-23)
  3. * Day of month (0-31)
  4. * Month (1-12)
  5. * Day of week (0-6)


So as an example to kill the Firefox every monday at midnight (So you won't surf all night xD):

0 0 * * 1 killall firefox


To add or edit the scheduled jobs type in terminal:

crontab -e


Or to edit jobs via graphical interface install the package 'gnome-schedule':

Note! Even with the GUI, you still need to know the commands you want to run :P


There are of course myriad backup applications available for Linux, which are handy if all you want to do is to backup folders. For most benefit you can use them too with Dropbox or Ubuntu One, or simply set them to upload backups to a FTP server.

Some simple but good ones:

Déjà Dup

http://freshmeat.net/projects/deja-dup




Back In Time (has KDE & Gnome versions available)

http://backintime.le-web.org/



0 comments: