Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
654 views
in Technique[技术] by (71.8m points)

cron job with CakePHP

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."

Please help me, how to solve it ??

Thanks in Advance

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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:websitesprojectnameappvendorsshellsfilename.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:websitesprojectnamecakeconsolecake

  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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...