Take the 2-minute tour ×

I have a requirement in which the end user will schedule a task and the web application needs to run that at the scheduled time and date.

I am on shared hosting in linux environment. I have used Cron for very basic email sending scripts. But in that case I had to set up cron from cpanel in the hosting.

Under the current requirement I need the end users to schedule jobs from the website frm the front end and the application doesn't know beforehand about the schedule. I need to do this using CI MVC.

Can I still use cron and if so how will I set up a cron job through CI controller?

Any help appreciated.

share|improve this question
your shared hosting should still have a cron tool. if not ask the admin for your account for best way to do it. then just set it for every hour, if there is no new job it just checks again in an hour. –  cartalot Aug 31 '13 at 1:46
add comment

1 Answer

You could use a service like EasyCron. Or it might be possible to put together a web interface for editing cron jobs.

The only other way I can think of is to implement some kind of pseudo-cron. WordPress does this - I understand it works by storing a timestamp in the database, and checking the time again every time it receives a request, then carrying out the task if it's not been done yet, and resets the timestamp.

share|improve this answer
I guess the pseudo cron would not work for my case as it needs to be a clock based trigger to execute the job. EasyCron is a viable option, the only thing worries me that my job URL would be public and can be executed by anybody if got an access. Put a web interface for creating/editing cron jobs is the most suitable option if it provides security. –  Abhishek Aug 31 '13 at 6:54
You could limit access to the job URL using .htaccess to ensure it can only be triggered by EasyCron - .htaccess can disallow requests based on IP address or domain name –  Matthew Daly Aug 31 '13 at 7:51
add comment

Your Answer


