views:

66

answers:

3

Hello

I have referred http://bakery.cakephp.org/articles/view/calling-controller-actions-from-cron-and-the-command-line and created cron_dispatcher.php and placed it in the app folder.

I have return some test email function for the cron job to run in my users controller's test method.

And i have created a Cron job in my web server's control panel like "/usr/bin/php /home4/enventur/public_html/pennystock/cron_dispatcher.php /users/test"

But its giving me an error as "No input file specified."

can you please help me, how to solve it

Thanks in Advance

+3  A: 

Hello,

The cron job is a long running process that executes commands at specific dates and times.

Go to your domain cpanel account.

First make the file which you want to run the code using cron job. and upload the file on your website root folder.

Now Go to "Cron job" section in your cpanel account and enter the file path in textbox and set the time shedule which you want to run the file.

Thanks.

Yunus Malek
Nice answer dear
Kanak Vaghela
+1  A: 

Sounds like PHP cannot find the file you specified. Check that the path is correct. For example:

# incorrect path
/home4/enventur/public_html/pennystock/cron_dispatcher.php

# correct path (?)
/home4/enventur/public_html/pennystock/app/cron_dispatcher.php

Now, this next part doesn't directly answer your question, but it's worth noting that CakePHP shells are intended for this exact purpose.

If you created a shell called Mailer and copied your UsersController::test() code to MailerShell::test(), you would call that from cron like this (again, check the paths are correct):

/home4/enventur/public_html/pennystock/cake/console/cake -app /home4/enventur/public_html/pennystock/app mailer test

With this approach, you wouldn't have to use cron_dispatcher.php as noted in that ancient Bakery article (written for CakePHP 1.1 on Christmas 4 years ago).

deizel
A: 

Hello,

I have done it in different way,

please see the steps, it may helpful for others..

Cron/Shell Using Cakephp Framework Structure:

  1. create F:\websites\projectname\app\vendors\shells\filename.php

    class ClassName extends Shell { //var $uses = array('Post'); //name of Model

    //Main function runs always when shell executes function main() { mail("[email protected]","Test","Test"); } }

2.set 754 permission to F:\websites\projectname\cake\console\cake

  1. Set cron job as /home4/enventur/public_html/pennystock/cake/console/cake -app "/home4/enventur/public_html/pennystock/app" ClassName >/dev/null 2>&1

/dev/null 2>&1: for Suppressing warning/error/msg from server

Thank you Nidhin

Nidhin Baby