Automatic MySql Database Backup Using Cron Job

Taking backup databases is a must for every webmaster. Make your life a little easier by delegating this boring but extremely important chore to the shell script that will do this automatically and silently everyday, or whatever time you choose, for you

For automatic MySql database backup using cron job, It would be quite important that you are at least a bit familiar with how cron works and how to use it to schedule your jobs.

Let’s now see the actual bash script code first (file named backup.sh) :

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#!/bin/bash

date=`date -I`

mysqldump -h your_domain -u userDB -pPASSWORD DBname | gzip > /home/hthought/backup-$date.sql.gz

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

It first gets the current date and stores it to a variable. The idea is that we will use this to form the name of the gzip file depending on the date it was created. You can see that on “backup-$date.sql.gz”. Therefore, if you create a backup on 23th of November 20011, you get a filename like “backup-2011-11-23.sql.gz”.

The command that is used in order to create the actual dump is mysqldump. Using the -h switch, we can specify the hostname of the server where the mySQL server is located. Thus, if mySQL runs on another server, let’s say whatever.com, you will be using “-h whatever.com”. If the server runs on the actual machine executing the script, you do not need to specify this switch, because it defaults to localhost. The idea of using -h is that we would want to create a backup on a remote server so that if a problem comes up on the server where mysql is located, we will be sure that the backups are intact, since they are located in another server.

Running the Script Daily

As you see the script is pretty simple. The only thing that we need to do now is have it run automatically every day (or whenever you like to do that). As i mentioned before, we will be using cron to do that. We open up cron using “crontab -e” as the user we currently are (not root). Then, we add a line like :

0 0 * * * /bin/sh /home/hthought/backupPlace/backup.sh > /dev/null 2>&1

Simply, this script runs when the minute is 0 and the hour is 0 on whatever weekday of whatever month. Simply put, on each day there is only one time when the hour is 0 and the minute is 0 and that is the midnight. Therefore, this script runs once per day, every midnight. Moreover, since i do not really care about cron’s logs (and don’t really want to get useless mails), i redirect output to /dev/null/ , shamelessly trashing it.

Cloud Hosting for Mobile OS Migration

Tips on cloud Based Hosting That You Need when Migrate to a Different Mobile Operating System (OS).


Cloud hosting services are useful for backing up files and data should users decide to migrate to a different mobile operating system (OS). This is one of several tips from mobile consumers to make the switch less cumbersome.

U.S.-based system analyst Tom Nguyen, who has used phones running on Research In Motion's BlackBerry OS, Apple iOS and Google Android, suggested users tap a centralized data management system to store files. With the data stored elsewhere, users will not need to worry about moving files from one device to another when they switch.

Using cloud-based hosting for all your files is a good way to be platform independent. You can even host your own cloud or file server so you can connect to it whenever you want, using whatever device of your choice.

Before switching to a new operating system, Nguyen said users should sync data into their computer, including contacts and phone numbers, documents, videos, pictures, bookmarks as well as all hidden files or protected folders if any. "Make a full backup of your current phone if necessary.

To future-proof their app investments, users need to do some research on the apps they want to buy to make sure the developers have made the same apps available on other platforms. For example, Amazon Kindle app is a good choice for books since it is available on iOS, BlackBerry, Android and Windows Phone 7.


NOTE: Backing up files and data are essential to ensuring success with hosting platform including cloud host service.

Virtual Internet and its new Virtual Datacenter

Virtual Internet have announced a new product called Virtual Data-Center, a control panel allows users to launch multiple cloud servers automatically from 15 locations around the world.

The control panel offers a quick, step-by-step process to launching multiple servers. Once they have chosen a location and the amount of resources they want for the server, they are ready to launch and the server is deployed within minutes.

Utilising the latest cloud hosting technology, the servers are able to offer full scalability along with excellent speeds. The VI cloud brain is able to dynamically assign the RAM and CPU as your cloud server needs. Say goodbye to slow sites and downtime all with the click of a button.

Customers are able to launch servers from 15 locations, including those in the UK, mainland Europe, USA and Asia. Virtual Internet is hoping that this will help the product to have a global reach.

Patrick McCarthy, Managing Director of Virtual Internet, said 'We found that what our customers were really after was a control panel that not only let them manage their current host servers, but also enabled them to launch new VPS simply and quickly, without having to begin a new contract.

Welcome to Web Hosting Industry News and Updates

Hi All..........

Welcome to The World of Web Hosting Industry News and Updates. Here we try our best to update you with the latest updates on web hosting, web hosting technology, cPanel web host guide, online web hosting services etc.

We also try to update you with information on professional web hosting service providers and review on reliable web hosting.


Thanks.