whenever
whenever copied to clipboard
Issue when using runner
When I use runner, I have issue in crontab -e
In config/schedule.rb
every 2.minutes do
runner "GuestsCleanupJob.perform_now"
end
In crontab -e
0,12,24,36,48 * * * * /bin/bash -l -c 'cd /home/ubuntu/testapp && bundle exec bin/rails runner -e production '\''GuestsCleanupJob.perform_now'\'''
I am sure the crontab update is error.
'\''GuestsCleanupJob.perform_now'\'''
Why crontab is updated like this?
Thanks
I refactored my class method into a rake task, which helps me run the task manually whenever I want. I also don't understand the extra single-quotes.
I run into a similar issue:
runner "AdminNotifier.deliver('Cronjobs are working!')"
becomes
cd /rails && bundle exec bin/rails runner -e production '\''AdminNotifier.deliver('\''\'\'''\''Cronjobs are working!'\''\'\'''\'')'\'' >> /proc/1/fd/1 2>&1
I suggest not using runner as it seems unreliable. Maybe the README can be updated?