CodeIgniter Forums
CodeIgniter Cron Jobs - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CodeIgniter Cron Jobs (/showthread.php?tid=49766)



CodeIgniter Cron Jobs - El Forum - 03-02-2012

[eluser]IanMcQ[/eluser]
I am really excited about the new addition that allows you to execute CodeIgniter code from command line.

As of right now, all of my cron jobs are in horrible un-codeignited PHP code and I'm re-writing them in CodeIgniter (so many less lines!).

So let's say I go:

Code:
/usr/bin/php index.php cron this_cron_function
In this_cron_function, how can I determine whether or not this is a command line request? For example, what's from stopping a user from going to mysite.com/index.php/cron/this_cron_function and executing the entire procedure?

Is there any kind of way to determine the difference in requests? How can I ensure that the cron.php Controller can only be accessed and executed by a system command?

Thanks.


CodeIgniter Cron Jobs - El Forum - 03-02-2012

[eluser]CroNiX[/eluser]
User Guide: Input. Read the very bottom Smile


CodeIgniter Cron Jobs - El Forum - 03-02-2012

[eluser]IanMcQ[/eluser]
Damn. Smile I can read English.

Haha, thanks for pointing that out. I knew it must be something simple I'm missing. Thanks much.