mrbuter Posted March 13, 2009 Share Posted March 13, 2009 Hi, quick question: are exec() commands vulnerable to timeouts? I'm going to use it to run a mysqldump with a $date command so that it doesn't overwrite (among other things). Then I'm going to make a cron to run it every 24 hours. I tried to append a date to the file using cron jobs and cPanel but it wasn't working...lol. So yeah, my question is if I use exec(), can the dump time out and leave me with a broken backup? Quote Link to comment https://forums.phpfreaks.com/topic/149189-exec-question/ Share on other sites More sharing options...
MadTechie Posted March 13, 2009 Share Posted March 13, 2009 Hope this help (background won't be affect by timeouts) Note: If a program is started with this function' date=' in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends.[/quote'] Quote Link to comment https://forums.phpfreaks.com/topic/149189-exec-question/#findComment-783435 Share on other sites More sharing options...
trq Posted March 13, 2009 Share Posted March 13, 2009 If your going to write a script to execute a mysqldump via cron there is no point in using php at all. exec simply executes shell commands, you may as well write your script using your shell in the first place. Quote Link to comment https://forums.phpfreaks.com/topic/149189-exec-question/#findComment-783455 Share on other sites More sharing options...
MadTechie Posted March 13, 2009 Share Posted March 13, 2009 WOW.. i don't belive i missed that! Quote Link to comment https://forums.phpfreaks.com/topic/149189-exec-question/#findComment-783457 Share on other sites More sharing options...
trq Posted March 13, 2009 Share Posted March 13, 2009 Heck, depending on the task at hand you can simply execute mysqldump directly via cron. eg; 0 * * * * /usr/bin/mysqldump -u'uname' -p'upass' dbname > ${HOME}/dump.sql Quote Link to comment https://forums.phpfreaks.com/topic/149189-exec-question/#findComment-783462 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.