![]() |
Running CI Scripts from command line - Possible solution - 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: Running CI Scripts from command line - Possible solution (/showthread.php?tid=4616) |
Running CI Scripts from command line - Possible solution - El Forum - 12-06-2007 [eluser]fry-guy[/eluser] While developing a newsletter script, I came across a solution to run my mailing script through the command line. Here's what I did: 1. Create a script called mailer.php in the main folder (where index.php is located) /mailer.php - with the following content Code: // Mailer.php the mailing.txt file contains variable that needs to be passed to the mailing script. Then run the script through the command line: ~]$php mailer.php It works perfectly well for me, but I am not using mod_rewrite on this particular application and I have not tested it with mod_rewrite enabled. I will do that sometime this week and post the result here. I hope someone will find this useful. :-) Running CI Scripts from command line - Possible solution - El Forum - 12-06-2007 [eluser]gtech[/eluser] thanks for that, that will be very useful to me. Running CI Scripts from command line - Possible solution - El Forum - 12-06-2007 [eluser]Grahack[/eluser] There are some other tricks like that in the wiki: models from outside script CI cron use CI in other frameworks/apps Running CI Scripts from command line - Possible solution - El Forum - 01-04-2008 [eluser]yongkhun[/eluser] fry-guy's way not working for me. It just keep giving me Page Not Found error... Running CI Scripts from command line - Possible solution - El Forum - 01-04-2008 [eluser]fry-guy[/eluser] [quote author="yongkhun" date="1199464515"]fry-guy's way not working for me. It just keep giving me Page Not Found error...[/quote] Are you using mod rewrite? If you are, then try this Code: ini_set("max_execution_time","0"); Save this file (e.g. cron.php) in your root codeigniter folder (where index.php is located) and then run throught the command line: Code: $ php cron.php controller/function Hope this helps Running CI Scripts from command line - Possible solution - El Forum - 01-04-2008 [eluser]Peter Ivanov[/eluser] Hello, if you want to run CI scripts from the command line why don't you use: Code: curl http://url_to_script/test.php |