Step 1: Create a simple backup script
Using bash scripting, we will work to create a simple backup script which will do several things: 1) capture the date, 2) create a compressed copy of what we want to backup, 3) copy the compressed copy to the desired location, and 4) remove the compressed copy from the original location. Simply put, we are going to create a compressed copy and put it where we want it.
Here is a basic example of the bash script we will be using (copy and save the script as backup.sh in your backup location):
#!/bin/sh
## Script to backup Thunderbird
set -x
x=`date +%Y-%m-%d` ## Backup needs a date (stamp)
## Create an archived copy
tar zcf thunderbird-${x}.tgz /home/michael/.thunderbird
## Place the archived copy in the thunderbird folder
cp thunderbird-${x}.tgz /home/michael/Backups/thunderbird
## Remove original copy as we don't need two
rm ./thunderbird-${x}.tgz
Make sure to change the file permission to allow the script to executed as a program. This can be done through Nautilus by right clicking the file and choosing Properties. Select the Permissions tab, place a check mark where you see "Allow executing file as program" and click Close.
In this simple backup script, we are creating a tgz copy of the files used for Mozilla Thunderbird. First we capture the date (x) and use it to create the file name. Since the script is used to backup more than one item (not listed here) it is placed inside a folder titled Backup. A sub folder of Thunderbird exists, so the file is moved there and then removed from the main folder.
Note: If you are using a different location for your backups, change the paths to the file in line 4 and the backup locations in lines 4,5 and 6.
Keep in mind, you could add in other items to be backed up inside this script. For instance, I use it to backup Firefox, Pidgin, and Filezilla in addition to Thunderbird.
Step 2: Schedule the Backup
Cron is the tool used to schedule tasks in Ubuntu Linux. This is a command line tool, so we will be looking at Gnome Scheduler, a front-end GUI for cron. If you do not already have cron and Gnome Scheduler installed, install them using your chosen method for installing from the repositories. It will be placed in the System Tools folder under the Application menu.
Open Gnome Scheduler and click New in the top left corner. For our purposes, we will be creating a recurrent task (one that happens over and over again) so select "A task that launches recurrently". There are several items you will need, so let us look at an example. Using the script to backup Thunderbird, assuming the path to the backup file is /home/[user]/backups/backup.sh, let us set up a weekly backup to run on Mondays at 2:30 PM.
Description: Weekly Thunderbird Backup
Command: sh /home/[user]/backups/backup.sh
Leave as using the default behavior
Select Advanced under date & time and enter the following:
Minutes: 30
Hour: 14 (0 - 23, since it uses a 24 hour clock)
Day: *
Month: *
Weekday: 1 (0 - 7, with 0 as Sunday)
Click Add
You will be prompted about recurrent tasks being run from the home folder (/home/[user]) which is fine. Click OK
You should now have everything setup to run weekly backups of Thunderbird.
Published by Michael Mann
With over 12 years of professional experience as a Web designer and over 25 years of general computer experience, I am often the resident tech . I own and operate Michael Mann Desktop Publishing, a desktop p... View profile
- How to Make Ubuntu Look NiceHow to install Ubuntu linux and Compiz to add nice visual effects.
- How to Create Mozilla Thunderbird Email Profiles on a NetworkThis tutorial will show you how to make your own home email server. We will use Thunderbird to set up profiles for each user on a network for ease of remote access.
- How to Properly Open Rar or Zip Compressed FoldersThe problem with this is that a lot of people have no idea how to open a rar file once they have download the information which is send to them. The following steps will make it possible for you to do so.
- Why You Shouldn't Convert MP3s to MP3sHere's a look at why it's a bad idea to convert an mp3 to another type of mp3, and what you'll lose in the song if you choose to do so.
MainMenu - a Menu Bar Enhancement to Facilitate Common Mac Maintenance T...MainMenu is a fantastic utility that puts a tiny icon in your menu bar, from which a Mac user can run all kinds of common maintenance tasks, including everything from clearing o...
- Automate Ubuntu Backups with Cron and TAR
- Automating Ubuntu Backups with TAR and Cron
- QuickStart - an Ubuntu Script to Perform Common Terminal Tasks from a GUI
- Ubuntu Linux Install Gets Even Easier
- Ubuntu Linux: What the Popular Open Source Operating System Has to Offer
- Ubuntu Linux a Powerhouse OS for Everyone
- Top 3 Tips for New Ubuntu Users



