Ask Your Question

How to check cron in puppet Agent

asked 2015-12-11 14:19:16 -0600

sandeep gravatar image

How to check cron that is running in puppet agent? Also how to start and stop cron based on our priority and requirement.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-12-11 20:18:49 -0600

GregLarkin gravatar image

What OS type and version are you working with? Generally, the answer will be to use a service resource something like so:

service { 'crond':
  ensure => running,
  enable => true,

Of course, the "crond" value is OS-dependent, so you may have to change that. If you need to start and stop the service based on some other condition, then you'll have to develop supporting code to determine the value of the ensure attribute, and you'll end up with something like:

$should_crond_run = call_some_function_or_other_process_to_determine() ? {
  true    => running,
  default => stopped,

service { 'crond':
  ensure => $should_crond_run,
  enable => true,

I'm not sure if that selector that converts true/false to running/stopped is 100% necessary, but you can figure that out by reading the documentation for the service type.

Hope that helps.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-12-11 14:19:16 -0600

Seen: 68 times

Last updated: Dec 11 '15