TIP: Automating Website Backups - Part III (Cron Made Easy)


The question that we will be answering today is: **Q2: **Cron? Using tar, making up the script file is enough command line for me. Isn’t there an easy way? Cron is a tool that can schedule any kind of tasks for you, and here we are using it to run our backup script automatically, so that we can concentrate on blogging. Now, most of us are phobic of anything that has anything to do with command line. And we already have enough of command line stuff in this series. So, you can breathe a sigh of relief for a few moments because atleast the cron part can be made Web/GUI based for you (The command line method for cron was given in the first part). The details that I’m going to present here are relevant for cpanel but it might differ for you (very minor to very major) as your webhost might have a different panel for you (e.g. vdeck) or even your cpanel might look very different. But the basic concept remains the same and with a bit of common sense, you can apply this concept to your site easily.

Step1) Look for some option in your control panel, which says something on the lines of “cron”, “cron job” or such. e.g.:

Automating_website_backups_cpanel1

Step2) If you get a screen as shown below, choose the experience level as “Standard” (maybe “novice” or similar in your panel). After all, we are using it because we want to avoid that unixy-command-line-stuff .

Automating_website_backups_cpanel2_cron

Step3) You will get a screen as shown below.

Automating_website_backups_cpanel3_cron

First, fill in the e-mail ID to which you want the script output to be sent to. (e.g. tar will output the list of files that were backed up) (e.g. [email protected])

Then, give the “full” path (yes, starting from the root “/”) to your script that has to be run (e.g. /home/myusername/backup/backup.sh)

Then, choose the periodicity/time when this script has to be run, e.g., here we have chosen the script to be run everyday at 10:00 PM. **IMPORTANT: **Note that the time given here is GMT, so add your timezone offset. Generally, you should select a time when you expect the load on your website to be the lowest. e.g. I have selected a time of 3:00 AM everyday.

Press “save”, “done”, “add’’ or whatever similar button you can find and it’s over . That was easy innit?

That’s it for today. Lemme know if you have any doubts, or if you would like to see any other questions answered in this series. The question that will be answered next time (in “hopefully” the last part of the series) is:

Q3: Well, backup is all hunky-dory. Now, how do I restore?


See also