HOW TO SCHEDULE BACKUPS FOR WAMP FILES AND DATABASES

October 23, 2015   /   by Marco  / Categories :  Technology, TIP AND TRICKS

I managed to figure out a way to backup the WAMP files and databases by using the Windows Task Scheduler and a batch file. The batch file includes using mysqldump (already part of the WAMP install), 7-zip (a free open source compression tool) and gzip (for the database compression).

BATCH FILE

Let’s have a look at the batch file:

You can download the above batch script in a file from the resources section at the bottom of this post.

The first statement compresses the wamp/www folder. The name of the zip file includes the date and time by using the syntax in bold:

You can actually exclude other folders from the zip file by using the statement in bold at the end of the zip compression:

The next line dumps all the databases and compresses it by using gzip. You will need to download and save the gzip tool as it doesn’t actually come preinstalled with WMAP. You will also need to specify the full path of where the gzip command is located. Note that your path where mysqldump is located could be different because of the version of WAMP you’re using. When dumping the database you need to make sure you have an account with the correct permission. In the below command I used an account called backupuser with the password backupusername123. Yes – it’s not very secure having the password in a file and clear text but I use mine on a standalone environment that does not have access to the Internet so use it at your own risk.

The next line copies the files to an external thumb drive. That’s must a backup of a backup in case the physical hard disk drive. You can remove these lines if you think it’s overkill or alternatively you can just backup to the external thumbdrive by changing the c: to the drive of the thumb drive. In my case I

VISUAL BASIC SCRIPT

In order to run a scheduled task silently, you need to use a Visual Basic Script. The one I have used is as per below.

You can download the above batch script in a file from the resources section at the bottom of this post.

Just change the path to the batch file in the script:

WINDOWS TASK SCHEDULER

To automatically run the backup I used the task scheduler within Windows. Just create a new task:

WAMP Backup Scheduled Tasks

Enter a description

WAMP Backup Scheduled Tasks Description

Select when you want to run the task. In my case I run the backups monthly

WAMP Backup Scheduled Tasks Task Trigger

Select the time and the months you want to run the task. I selected 11:00PM because this is a quite time where the PC is not being used.

WAMP Backup Scheduled Tasks Task Trigger Monthly

Select the date when to run the backup. I selected the 1st of every month

WAMP Backup Scheduled Tasks Task Trigger Monthly Days

Select the Action which is to Start a Program

WAMP Backup Scheduled Tasks Action Start Program

Select the file where the Visual Basic Script is located

WAMP Backup Scheduled Tasks Program

Click on Finish.

WAMP Backup Scheduled Tasks Finish

Your task will then be listed in the Task Scheduler Library like this.

WAMP Backup Scheduled Tasks Listed

CONCLUSION

There are a number of ways to backup WAMP, this includes using other paid Software Tools. There may be some that are FREE but I prefer to keep it simple and use batch files.

RESOURCES
List of resources related to this article:

7-zip application – open source tool to backup files

GZIP tool – to compress databases. You can then use 7-zip to uncompress

WAMP – A Windows Based web server environment

Backup Batch File – Example batch file I used to run the database and file backups

Backup Visual Basic Script – Example Visual Basic File I used to run the batch file 

 

DO YOU LIKE WHAT YOU'VE READ?
Join our subscription list and receive our content right in your mailbox. If you like to receive some Great deals our Freebies then subscribe now!

Our Sponsors

  • Follow us:

OTHER ARTICLES YOU MAY LIKE


HOW TO CHANGE THE SEND FROM NAME IN ZOHO MAIL

HOW TO CHANGE THE SEND FROM NAME IN ZOHO MAIL

So I spent hours trying to resolve this and finally managed to land on the correct instructions and decided to share it with my readers. I use ZOHO MAIL for email hosting on some of my domain names and when I tried sending an email from one of the accounts, the FROM name was not […]

read more
SOLVED ISSUE WITH FACEBOOK TOO MANY REDIRECTS

SOLVED ISSUE WITH FACEBOOK TOO MANY REDIRECTS

It appears some of you may be facing an issue with Facebook displaying an error message This page isn’t working right now www.facebook.com redirected you too many times ERR_TOO_MANY_REDIRECTS after you’ve logged into your Facebook account. I shared the detailed solution here: HOW TO FIX FACEBOOK TOO MANY REDIRECTS I thought I’d share this here with […]

read more

Subscribe

Receive the latest news and awesome deals via email

Like our Page

Social Wall Social Wall