How to Set the cron for Codeigniter in ubuntu ec2-instances

 “set the cron for codeigniter in Ubuntu ec2-instance” It is very easy to do this .

lets say you domain is www.abc.com and your controller is “Category” and Method is “test” on which you wants to apply a cronjob :-

If you simply hit that function on browser than

the url will be :-http://www.abc.com/index.php/category/test

or

http://www.abc.com/category/test

Just login into your instances by putty and follow below steps :-

1-type crontab -e // for edit the cron or creating the new one

2-choose a editor to edit the cron

set the time as per your need to hit the cron by
* * * * * and the above url

5 stars are explained below:
1st star:      Minute (ranges from 0-59)
2nd star:     Hour  (ranges from 0-23)
3rd star:      Day (ranges from 1-31)
4th star:      Month(ranges from 1-12)
5th star:      Day-of-week (0-7. 0 & 7 is Sun. 1-Mon, 2-Tue,3-Wed,4-Thur … etc)

let say you want hit the corn at 11:15 Am daily once in a day than cron path will be

15 11 * * * curl –silent http://www.abc.com/index.php/category/test

or

15 11 * * * curl –silent http://www.abc.com/category/test

Type the above url in cron editor and for save CTRL+X and Shift + Y than enter to save the cron .

For checking the cron is properly  set or not ,

we can check with “crontab -l” command.

which is used for listing  all the existing crons.

 

 

Check it also

Chech the ubuntu Docs