0

I am trying to set a cron job with the help of whenever gem in my Opswork Ruby on Rails App.

I have found these instructions as a whenever recipe, but since I don't know much about Chef I am a little bit lost.

The suggested code:

Just include whenever in your node's run_list:

{
  "name":"my_node",
"run_list": [
"recipe[whenever]"
]
}

I was adding it in the layer settings as a custom JSON but I get an error when I try to deploy:

ERROR: please set the node's run list using the 'run_list' attribute only.

I'm defining my cron job as follows:

#config/schedule.rb
env :PATH, '/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/opt/aws/bin'

every 1.day, :at => '4:30 am' do
  runner "UserMailer.mailgun.deliver"
end

I have added whenever::deploy to my recipes under the layer settings as suggested here and the update cookbooks command was successful, but when I tried to deploy I had an error stating whenever recipe was not found

How should I set whenever or the cronjob in order to run in AWS?

Community
  • 1
  • 1
marimaf
  • 5,382
  • 3
  • 50
  • 68
  • this link: http://stackoverflow.com/a/21125575/3307520 – Cyzanfar Apr 27 '16 at 19:49
  • @Cyzanfar I added the cookbook to the stack setting (https://github.com/StemboltHQ/frt-opsworks-cookbooks/tree/master/whenever) and added the recipe to the layer setting in the deploy section, but I get ERROR: 412 "Precondition Failed" no such cookbook whenever – marimaf Apr 27 '16 at 20:47
  • Myabe your directory setup is wrong take a look at this: http://stackoverflow.com/a/18058996/3307520 – Cyzanfar Apr 27 '16 at 21:00
  • @Cyzanfar I added whenever::deploy to my cookbooks as suggested in that link and when I ran updated cookbooks it was successful, but when I tried to deploy it said whenever cookbook not found – marimaf Apr 28 '16 at 14:46

0 Answers0