I couldn’t figure out why my cronjobs weren’t executing correctly. They
would run, but the code would not be executed. Here’s what the problem
was:
This was the cronjob that was not working correctly:
-
-
-
-
- /path/to/app/script/runner -e production “Code.to_execute”
And this is what I had to do to get it to work:
-
-
-
-
- cd /path/to/app/; ./script/runner -e production
“Code.to_execute”
Why does changing into the app’s directory before executing runner make
a difference? Anyone else run into this before?
Why does changing into the app’s directory before executing runner make
a difference? Anyone else run into this before?
Dunno, but change that cron to this:
cd /path/to/app && ./script/runner…
That way if for some reason it can’t ‘cd’ it won’t try and do the
‘runner’…
-philip
Ryan M. wrote:
I couldn’t figure out why my cronjobs weren’t executing correctly. They
would run, but the code would not be executed. Here’s what the problem
was:
This was the cronjob that was not working correctly:
-
-
-
-
- /path/to/app/script/runner -e production “Code.to_execute”
And this is what I had to do to get it to work:
-
-
-
-
- cd /path/to/app/; ./script/runner -e production
“Code.to_execute”
Why does changing into the app’s directory before executing runner make
a difference? Anyone else run into this before?
Hi Ryan M.
Thx very much for your answer. I am also facing the same situation
before reading your post. Now me 2 execute my cron file successfully.
Thank you