Today I will show you how to schedule a backup in Ubuntu 12.04 using cron.
The cron daemon uses the crontab file (think Task Scheduler in Windows) which allows you to set the backup schedule. The beauty of using cron is that it works ON ALL LINUX DISTRIBUTIONS not just Ubuntu. You don’t even need to install cron as it comes installed by default.
Ok time to get your hands dirty. Open up a terminal and type “su” and when prompted enter your root password. Next you want to open up the crontab file so type “nano /etc/crontab” in a terminal. The crontab file should look similar to the table below.
|1||9||*||*||*||Root||Tar -cvf/media/dev/sdb/backup.tar /home|
M = minutes
H = hours
Dom = every day in the month
Mon = every month
Dow = every day of week (e.g 1-5 would be Monday to Friday inclusive)
User = user who can perform this task
Command = what is getting backed up and where is it getting sent to
Lets explain this a bit. In the above example I have backed up a folder called home (/home) to a folder called backup.tar which is on sdb (/dev/sdb/backup.tar) at 1 minute past 9 everyday in the month, every month. The authorised user is root and the command to be used is Tar -cvf.
When you have configured the crontab file save it and exit. Your backup schedule is now set.
About the Author
Hi I am Chris Wakefield the owner of ComTech IT Support. I provide Windows and Linux based IT Support, laptop repairs and computer repairs to both business and personal clients throughout Stirling, Falkirk and Clackmannanshire.
For a list of what I can offer you why not visit my website www.comtech247.net where you will find a list of my services, testimonials, blog and much more!!