On 09/04/15 02:01 AM, Peter Bukowinski wrote:
> On Apr 9, 2015, at 1:26 AM, Gabriel Filion <
gab...@lelutin.ca> wrote:
>> A client of mine needs to be able to control which hours during the day
>> a certain daemon is running and which hours it is not.
>>
>> So far I can think of hiera for controlling the on/off periods + some
>> math magic to determine in the puppet manifests whether we are currently
>> in the On or Off period (which would ensure either "running" or "stopped").
>
> This seems like an overly-complex approach.
right
>> The other option could be a custom fact (which would make manifests less
>> complicated), but I'm unsure of how control over the on/off time periods
>> could be achieved in this case.
>>
>> Am I more or less on to something with the above or am I trying to do
>> something with the wrong tool? One of the downsides of using puppet is
>> that runs are only once per hour (in that case) so the starting and
>> stopping times might be unreliable :\
>
> Puppet is really good at managing steady states. Why not have puppet manage cron entries responsible for starting and stopping the daemon? A custom fact could be used to return the current on/off state (accurate as of the last puppet run, or course) of the daemon for auditing purposes.
ah yes, I actually had thought about this but forgot to mention it. this
would be actually more reliable time-wise.
my only concern would then be if the service crashes during the "on"
period or gets started by someone for any reason in the "off" period and
forgotten there. puppet would add a safety net by ensuring the service's
state.. I'll have to verify if this can be possible and/or a concern
before I try to fix this part.
thanks for the input.
--
Gabriel Filion