Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Puppet: cron schedule - "is not a valid hour" error

I need to schedule a cron job for daily running every 30 mins from 0 to 6 and from 13 to 23. 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 fails with

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

What hour format should I use? Do I need any other changes in cron clause?

like image 207
Maksym Polshcha Avatar asked Mar 19 '23 04:03

Maksym Polshcha


1 Answers

Close, but no cigar.

cron { "MyJob":
    ensure  => present,
    command => "my-cron-command",
    user    => 'root',
    hour    => [ "0-6", "13-23" ],
    minute  => '*/30',
    environment => "MY_ENV"
}
like image 176
Felix Frank Avatar answered Mar 26 '23 01:03

Felix Frank