Puppet: cron schedule - error "invalid hour"

I need to schedule a cron job to run every 30 minutes from 0 to 6 and 13 to 23 every day. I tried this code:

cron { "MyJob":
    ensure  => present,
    command => "my-cron-command",
    user    => 'root',
    hour    => "0-6,13-23",
    minute  => '*/30',
    environment => "MY_ENV"
}

      

This doesn't work with

0-6,13-23 is not a valid hour

      

What format hour

should you use? Are there any other changes needed to the cron suggestion?

+3


source to share


3 answers


If you add multiple values ​​for any attributes. Put them in a list of arrays. SO, the hour will be ['0-6', '13 -23 ']



+1


source


You just need to specify the hours:

cron { "MyJob":
    ensure  => present,
    command => "my-cron-command",
    user    => 'root',
    hour    => [0,1,2,3,4,5,6,13,14,15,16,17,18,19,20,21,22,23],
    minute  => '*/30',
    environment => "MY_ENV"
}    

      



Works but hour => "0-6,13-23"

doesn't work.

+1


source


Close but no cigar.

cron { "MyJob":
    ensure  => present,
    command => "my-cron-command",
    user    => 'root',
    hour    => [ "0-6", "13-23" ],
    minute  => '*/30',
    environment => "MY_ENV"
}

      

+1


source







All Articles