Saturday 15 May 2010

Trying to write a shell for cakephp to use in a cron job -


I have written a model and controller method that I wanted to use through cron jobs, though it appears in the investigation I have read many such posts and manuals to do this as a shell with the console / command, but it is a little bit on my head.

This is what I have done so far - what was there in my model and controller, can someone give me some hints to work on it? thank you in advanced.

**** Edit - it works now ****

    

Modified questions based on answers and comments - it still works though Cron doesnt find it in another question.

In the 2.x you not the use of: import ()

You should use controllers in the circle

The latest 2.x branch cake email class, , Controller etc. (eg: wherever you like) EmailConnant is now a cover to keep the back compatibility for it.

As far as the code goes, the shells are the same Controllers. You can specify the model to use as you get the controller and data exactly the same.

Check documents on sending emails, its very simple ...

  $ email = new kemmail (); // Set Config, Add Users, etc. $ Email- & gt; Send ();   

Then you run it in the cron in normal

  0 * * * * / path / to / app / console / cake foam - prefix. .. etc    

No comments:

Post a Comment