开发者

Running cron job from browser

I have several cron jobs that run automatically, and I was requested to add a button that says 'run now' in the browser... Is thi开发者_StackOverflows possible? Some of these cron jobs need to be executed from command line as they take around 15 minutes... Is it possible to execute them from the browser, not as a normal php function but somehow trigger an external php from the browser?


You're looking for the exec() function.

If it's a 15 minute task, you have to redirect its output and execute in in the background. Normally, exec() waits for the command to finish.

Example: exec("somecommand > /dev/null 2>/dev/null &");

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜