skip to Main Content

So i have this php function path in codeigniter which I am trying to run through cron job in ubuntu. But whatever I have tried it is not working. The command I have tried so far

* * * * * /usr/bin/php http://localhost/QAPIv2/updateTestData

But it is not executing. I am using codeigniter

3

Answers


  1. Please call the function from the command line.

    $ cd /path/to/project;
    $ php index.php controller function
    

    Please change the controller and function according to your code.

    Login or Signup to reply.
  2. To elaborate on Rohan’s answer, you run the functions like php index.php controller function. So, for example, to run your script every Tuesday at 8:31AM, your crontab entry should look like :

    31 08 * * 2 cd /path/to/codeigniter; /usr/bin/php index.php QAPIv2 updateTestData;
    
    Login or Signup to reply.
  3. Try this:

    */1 * * * * /usr/bin/php /var/www/html/YOUR PROJECT FOLDER NAME/index.php YOUR FUNCTION NAME > /dev/null 2>&1
    

    First number is time for cron.In function name you should give the controller function name which you want to load in cron.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search