1

Is it possible to set cron to run per minute? I have tried two ways below with no luck. I have reviewed the documentation: https://docs.chef.io/resources/cron. The way the documents reads to me is that I can only run cron in a specific minute within a specific hour. Like 8:05. Rather than every single 5 minutes.

  cron 'Check-In to Chef Manage every minute' do
      minute '*'
      command 'chef-client'
      action :create
    end
  cron 'Check-In to Chef Manage every minute' do
      minute '0'
      command 'chef-client'
      action :create
    end
1
  • 1
    The cron resource really maps what a crontab entry does, hence why it accepts a string, so minute '*/5' or minute '0,5,10,15,20,25,30,35,40,45,50,55' should work.
    – Tensibai
    Commented Mar 29, 2023 at 15:15

1 Answer 1

0

The correct answer is in the comments by Tensibai. The following worked:

cron 'Check-In to Chef Manage every 5 minutes' do
  minute '*/5'
  command 'chef-client'
  action :create
end

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.