puppet cron help

165 views
Skip to first unread message

Tim Dunphy

unread,
Feb 2, 2015, 5:55:58 PM2/2/15
to puppet...@googlegroups.com
Hey all,

I'm attempting to setup a cron job via the cron resource in puppet. 

This is what I'm trying to express via puppet:

*/30 * * * * /usr/bin/facter -y > /etc/mcollective/facts.yaml

This is what I've tried:

cron { "facts-cron":
           command => "/usr/bin/facter -y > /etc/mcollective/facts.yaml",
           user    => 'root',
           hour    => 0,
           minute  => '0/30'
       }

And this is the error I'm getting:

Error: Failed to apply catalog: Parameter minute failed on Cron[facts-cron]: 0/30 is not a valid minute at /etc/puppet/environments/production/modules/mcollective/manifests/config.pp:18
Wrapped exception:
0/30 is not a valid minute

What's the best way to ask for a cron job to run every 30 minutes in pupppet-ese?

Thank you,
Tim

--
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B

Cristian Falcas

unread,
Feb 2, 2015, 6:00:53 PM2/2/15
to puppet...@googlegroups.com
https://docs.puppetlabs.com/references/latest/type.html#cron

cron { logrotate:
command => "/usr/sbin/logrotate",
user => root,
hour => ['2-4'],
minute => '*/10'
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/CAOZy0emhiVJrc12NpXGPmT4LhUeaAK0SHM3ecqgUJgTuMnTTyQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

Joseph Karns

unread,
Feb 2, 2015, 6:00:57 PM2/2/15
to puppet...@googlegroups.com
Hello Tim:

Just like you would when manually adding a cronjob you should have '*/30', so your resource should look like this.


cron { "facts-cron":
  command => "/usr/bin/facter -y > /etc/mcollective/facts.yaml",
  user    => 'root',
  hour    => 0,
  minute  => '*/30'
}

Hope this helps!
Joey

Tim Dunphy

unread,
Feb 2, 2015, 8:18:37 PM2/2/15
to puppet...@googlegroups.com
Hey Joey & Christian,

Just like you would when manually adding a cronjob you should have '*/30', so your resource should look like this.
cron { "facts-cron":
  command => "/usr/bin/facter -y > /etc/mcollective/facts.yaml",
  user    => 'root',
  hour    => 0,
  minute  => '*/30'
}
Hope this helps!

 Very cool guys. Thanks for the examples! This helps. 

Best!
Tim

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

keith....@gmail.com

unread,
Feb 3, 2015, 7:34:26 PM2/3/15
to puppet...@googlegroups.com


On Monday, February 2, 2015 at 5:55:58 PM UTC-5, bluethundr wrote:

Tim Dunphy

unread,
Feb 4, 2015, 10:40:55 AM2/4/15
to puppet...@googlegroups.com
Cool! Thank you, Keith! 

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages