InMotion Hosting Support Center

Automated MySQL backup

Category: Databases

2013-01-15 1:07 pm EST

Hits: 902
I'm trying to schedule a mysql backup from cron. The job runs (not a cron) problem, but the mysqldump is empty. The script I'm running in in php, has permissions of 755, and I'm on a shared hosting plan (pro).

Here's a snippet of code with the command I'm trying to execute. In the example below $message is always null and $retval is 0.

Are we allowed to run exec() or system() from php? Perhaps that is my problem. if not, is there a way for me to accomplish this in some other way, like a Perl script or something?

$command = "mysqldump -u{$dbUsername} -p{$dbPassword} $dbName | gzip > $backupPath";

$message = exec($command, $output, $retval);

echo "$backupFile :: $message :: $retval";

You must login before you can ask a follow up question.

You must login before you can submit an answer.



43,761 Points
2013-01-15 4:12 pm EST
Hello Igontech,

It is best to have our Tier 2 or Systems team take a look at your specific script. They may have better ideas on setting up the code and what commands can and cannot be used when creating a Cron.

To do so, you would need to contact our support department at with that request. Be sure to validate your account with either the last 4 digits of the credit card on file, or the current Account Management Panel (AMP) password.

Best Regards,
Scott M

You must login before you can post a comment about this answer.

Like this Question?

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!