To make the cron job work, create a file called backup.sh and place the following code inside of it ::
mysqldump -h DB_HOST -u DB_USER -p'DB_PASSWORD' DB_NAME > YOUR_WEB_ROOT/db_backup.sql gzip -f YOUR_WEB_ROOT/db_backup.sql
In the above script you will need to replace the portions in ALL CAPS with your actual information as follows ::
This is the absolute path to your files. You can find this path by clicking on Hosting, Cloud Sites, Features, and scrolling down. This will be the "Linux Path" listed there. An example would be: /mnt/target02/123456/www.domain.com (Note, the /web/content is not included in that path)
Database Host an example would be mysql5-9.wc1 or mysql50-78.wc1.dfw1.stabletransit.com
The password on this database (note the single quotes and that there is no space between the -p and the single quote)
The database username (e.g.: 12345_username)
The name of the database you are backing up (e.g.: 12345_database_name). Note that there is no parameter for this option unlike the previous examples (-h -p and -u respectively).
Place this file in your web root and create a cron job (selecting "Perl" as the language - that will run shell scripts as well). Note, for step by step instructions on how to create a cron, Please visit our article on enabling and disabling cron jobs.
Put the name of the file, which, in our example is backup.sh in the "Command To Run Field". Select Perl as the Command Language and then select the interval in which you wish to run your backup script.
© 2011-2013 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License