[eluser]James Gifford[/eluser]
You can create a script which will call a CI controller from the crontab and run the code without using your webserver.
Here is how I handle this:
1. Make a new folder in your application directory for storing CLI scripts.
2. Copy the index page in your web root to a new file in your scripts folder (we'll call it script.php).
3. Add a line like this at the top of script.php:
Code:
$_SERVER['PATH_INFO'] = '/controller_name/method_name';
4. Change the system_folder and application_folder variables to point to the corresponding folders from the filesystem root. Because the script will be running without the webserver, you have to reference everything from the file root, not the web root. In my case this looks something like this:
Code:
$system_folder = "/Library/WebServer/system";
$application_folder = "/Library/WebServer/my_application";
5. Add an entry in your crontab for this script and schedule it to run when desired.