I'm running a PHP script to backup a mysql database on a cron. Everything's working fine, except the script has a header redirect (to run a file on another server, once the cron has run), and the cron seems to ignore this. Does anyone know if there is a way to run a script that has a header redirect with a cron?
I would think you'd want to just change the header call to an exec or system call....
You lost me on that one... How would that help?
Well, it would execute the remote script as well. I'm not real sure what you're expecting to accomplish with a header redirect on the command line...
Here's what I'm doing: http://www.ryanbrill.com/archives/backing-up-mysql-with-php/
I thought it was working (works fine, when called from a browser), but when the cron runs it, it doesn't call the file on my localhost.
Still no go. Again, works when a browser is pointed to the script, but not when run from the cron. Here's what I tried:
exec("/usr/bin/lynx http://xxx.xxx.xxx.xxx/backups/mysql_backup_grabber.php");
What if you use the PHP interpreter directly, instead of going through lynx?
How would I do that? If I leave off the /usr/bin/lynx it doesn't work at all...
That depends on how and where PHP is installed in your comp.
Once you figure that out, you should be able to run PHP yourself.
Hmm... I must have had something messed up somewhere when I tried this earlier, as this just worked:
exec("/usr/bin/lynx [url]http://xxx.xxx.xxx.xxx/backups/mysql_backup_grabber.php[/url]");
Thanks for you help. 🙂