Tuesday, February 19, 2013

How to backup and restore a site with GoDaddy

A. Backup of folder in Godaddy

The archive feature in the GoDaddy Hosting Control Center’s File Manager is very limit on the amount of files that it can archive. It imposed a limit of 20MB for achiving of files. As such we need to create a cron script to do backup of files for a folder.

For example, in order to backup $HOME/html/test folder, we will create a cron script like follows:
---
#!/bin/bash

NOWDATE=`date +%m%d%y` # Sets the date variable format for zipped file

tar -cvf $HOME/html/_db_backups/site_backup_test.$NOWDATE.tar $HOME/html/test

---

After that schedule this script as a cron job. This will do the job!

B. Backup of Database in Godaddy

This is simple. Use phpMyAdmin in Manage Database and export the database

C. Restore of data into local system

Download both the database and tar files generated to your local drive. Extract the tar files into a directory. As for the Database, as it is too big for phpMyAdmin to import, use the following command line to import it into database system. For example, if the Database name is testDB and the user name is testDB.user

C:\mysql.exe -u testDB -p -h localhost testDB.user < "test.sql" Enter password: *********

You may need to modify the .htaccess file in the extracted folder by comment out the following configuration statement:

#RewriteBase /

Hope help!