tags:

views:

441

answers:

2

I am trying to Add a CronTabs in a site{bidding site}, where the aspect to add a Crontabs is for the Autobidders.Please Someone guide me how can I add a Crontabs and how can I make it working,so that if any user adds up a auto bidder,it can place bid according to the server's time...!!! Thans in Advance..!!!

+1  A: 

You set the crontab up on the server - its just a system that runs a command at a given time.

First google result for crontab seems to cover the necessary stuff on this, and sure stackoverflow will have stuff too.

http://www.adminschoice.com/docs/crontab.htm

You then need to create controller actions in your app that are able to be called from the commandline to carry out the work you wish to do, and put these command(s) into the crontab to run at the relevant time.

Cakephp command line is where my knowledge runs out though. I've seen it done, but not done it.

benlumley
Okey thanks for your suggestion...!!!
Nishant Shrivastava
+2  A: 

In CakePHP, you need to create a shell to do the task. You can read all about creating a task here:

http://book.cakephp.org/view/110/Creating-Shells-Tasks

Tasks run the same way "cake bake" runs. You call cake task-name.

Once you have the task setup, you can use the cake shell to run the task from the crontab as benlumley suggested.

To run a cake shell command from the crontab, you simply say...

* * * * * (cd /path/to/app/directory; sh /path/to/cake/console/cake TASKNAME) 1> /dev/null 2>&1

This should get you started.

Dooltaz
+1 for mentioning shells. fyi, tasks "allow logic to be shared between shells" so just to save any confusion, don't waste time creating tasks unless you need to reuse the code!
deizel