Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
656 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 Reply

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("nidhin@2basetechnologies.com","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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...