A
A
Alexander Petrov2017-10-18 19:47:29
Ruby on Rails
Alexander Petrov, 2017-10-18 19:47:29

Why doesn't whenever work?

There is a model. With the help of whenever, I configured the task to run once a minute.
The retry code was written to the cron:

* * * * * /bin/bash -l -c 'cd /home/app/project/pervichka/releases/20171018162855 && bundle exec bin/rails runner -e production '\''Whenever.update_position_complex'\'''

But the code doesn't work!
I also tried to write it myself in the script like this:
* * * * * cd /home/app/project/pervichka/current && bundle exec rails runner -e production "Whenever.update_position_complex"

If you run this command in the terminal, then everything is done.
This is what comes to the cron logs:
Oct 18 19:46:01 pervichka CROND[23129]: (app) CMD (/bin/bash -l -c 'cd /home/app/project/pervichka/releases/20171018162855 && bundle exec bin/rails runner -e production '\''Whenever.update_position_complex'\''')
Oct 18 19:46:02 pervichka CROND[23128]: (app) MAIL (mailed 35 bytes of output but got status 0x0001#012)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Ponomarev, 2017-10-19
@ilyario

Try like this:

* * * * * /bin/bash -l -c 'cd /home/app/project/pervichka/current && bundle exec rails runner -e production "Whenever.update_position_complex"'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question