galvin Posted January 5, 2011 Share Posted January 5, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/223517-question-about-automatic-mysql-backups-using-cron-jobs/ Share on other sites More sharing options...
trq Posted January 5, 2011 Share Posted January 5, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/223517-question-about-automatic-mysql-backups-using-cron-jobs/#findComment-1155381 Share on other sites More sharing options...
galvin Posted January 6, 2011 Author Share Posted January 6, 2011 Thanks Thorpe, you're the best! I got the first way to work. Quote Link to comment https://forums.phpfreaks.com/topic/223517-question-about-automatic-mysql-backups-using-cron-jobs/#findComment-1155649 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.