Jump to content

Recommended Posts

 

Regarding the script (which was inspired by a PHPFreaks tutorial that I can't find) to automatically create MySQL backups and email them, I have the backups beings created properly and getting emailed properly.

 

Not I just have a question about the "automatic" part of it.

 

It says to use "Cron Jobs" which I have in my server's CPanel.  I understand everything it asks for except what to put in the "Command" field.

 

The file that I need to run automatically everyday is called "backup.php" and is in my main directory (meaniing it can be run by going to http://www.mydomain.com/backup.php).  Does that mean i simply put "http://www.mydomain.com/backup.php" in the Cron Jobs "Command" field?

 

I'm scared to just try it without knowing if it will work (since I have no experience with Cron Jobs), so hopefully someone here can confirm or deny my assumption.

 

Here is the link to the article about this script, if you care:... http://www.theblog.ca/mysql-email-backup

So, its a php script you need to run? A few ways to do it. If you know the absolute file system path to the you should use that and execute the script via php's command line interpreter. This way you can remove it from your website so that no one can request it and execute your backup.

 

So, to do that would look something like....

 

/usr/bin/php /home/yourusername/script.php

 

This tells Bash (your shell) to execute script.php using php's cli which is usually installed into /usr/bin/php

 

If you can't do it that way and must execute the script via your server (and therefore a url) you will need to use a program that can execute http requests. Curl or wget are your best options.

 

/usr/bin/wget http://www.mydomain.com/script.php

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.