0

the command works when its manually called, but does not when its on cron. I have used Cron Job in symfony2 this for referencing. did not work.

command in cron is:

55 09 * * * /usr/bin/php /var/www/symfony2/current/app/console mycommand >> /var/www/symfony2/logs/logthis.txt

the /current/ is a link from capistrano to the current version.

EDIT: I would like to add to peter_the_oak list. A obvious one but still.

if its not working

  • Check cron status

    sudo su
    /etc/init.d/cron status
    

    if it returns failed

    /etc/init.d/cron start
    

    was the case for me.

4
  • what's wrong with this? Commented Jul 28, 2014 at 7:24
  • Do you have any error log ? I can't see --env=prod in your command line. Is that correct ? Commented Jul 28, 2014 at 7:25
  • cronjob does not execute this command, I tried adding --env=prod flag but still no luck. the logs are empty, maybe im missing something? like a PATH to something? Commented Jul 28, 2014 at 7:39
  • 1
    Thx for marking the answer. Just out of curiousity: if you have solved the problem, which detail in the configuration was wrong :-) ? Commented Jul 28, 2014 at 8:01

1 Answer 1

1

Sometimes if cron jobs are not working, it's because one of these points:

  • Make sure the file permissions and the user are matching. https://askubuntu.com/questions/189189/how-to-run-crontab-as-userwww-data I know you'll say "it's just root", but as we don't see everything here, maybe there's some mistake.
  • Make sure you edit the tab the right way (crontab command)
  • Make sure the time definition are what you really mean. Your script will be run at 9:55 am, and what is the current time of your server?

So I suggest first write a definition with only stars to have every minute a call, and first call just some echo to observe. Then alter the echo to your real PHP command and observe again. After that, set the time parameter and check the server time. That should do it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.