Issue #2462 has been updated by Luke Kanies.

So what do you recommend as the actual behaviour here?  Should the minute just 
default to '0' or something?

And I'd certainly accept a patch that treated '*' as absent, but that seems 
like mostly a documentation problem.
----------------------------------------
Bug #2462: cron resources default behaviour with no periods seems potentially 
dangerous
http://projects.reductivelabs.com/issues/2462

Author: Simon Mudd
Status: Needs design decision
Priority: Normal
Assigned to: 
Category: cron
Target version: 
Complexity: Unknown
Affected version: 0.24.8
Keywords: 


As per http://reductivelabs.com/trac/puppet/wiki/TypeReference#cron

"cron

Installs and manages cron jobs. All fields except the command and the user are 
optional, although specifying no periodic fields would result in the command 
being executed every minute. While the name of the cron job is not part of the 
actual job, it is used by Puppet to store and retrieve it."

I think this behaviour is dangerous as it means that default behaviour is a to 
run a minutely job. That means that if the period fields are not specified by 
mistake the effect will be to generate very frequent cron activity.

I used to configure my cron jobs like this:

 cron {
        'minutely_script':
                command     => '/path/to/minutely/script',
                ensure      => present,
                hour        => '*',
                minute      => '*',
 }

However this generates extra logging, making it look like the configuration is 
incorrect (or not expected):

Wed Jul 29 15:45:17 +0200 2009 
//Node[dc01mdb-01.mydomain.com]/s_db/s_db::config/Cron[db_config]/hour 
(notice): defined 'hour' as '*'
Wed Jul 29 15:45:19 +0200 2009 
//Node[dc01mdb-01.mydomain.com]/s_db/s_db::cron/Cron[log_processlist]/minute 
(notice): defined 'minute' as '*'
Wed Jul 29 15:45:19 +0200 2009 
//Node[dc01mdb-01.mydomain.com]/s_db/s_db::cron/Cron[log_processlist]/hour 
(notice): defined 'hour' as '*'

>From my point of view the correct cron entries were being created.

A colleague of mine said:

"Nasty, if you forget the timings, you get the worst case of the most frequent 
run of your job. I would make the arguments required and not optional. Cron 
jobs that need to run every minute are rare in the real world so that shouldn't 
be the default."

I tend to agree. I would prefer that it's possible define '*' without getting 
special notifications, and perhaps even that if no period fields are specified 
that a warning is generated.

Also the documentation should say that it's possible to specify '*' for "all 
values in that period".

We are using a custom built rpm based on puppet-0.24.8-1 on centos4 and 5.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to