cookbook 'alphard-cron', '= 1.0.0'
alphard-cron (3) Versions 1.0.0 Follow1
Installs/Configures and Provides helpers definitions for cron
cookbook 'alphard-cron', '= 1.0.0', :supermarket
knife supermarket install alphard-cron
knife supermarket download alphard-cron
alphard-cron Cookbook
This cookbook provides a recipe to update cron and schedule service restart
Requirements
- Ubuntu 14.04
Chef
- Chef 12.0 or later
Attributes
alphard-cron::default
General
-
['alphard']['cron]['user']
- the user used to add crontab entries and create log file and directory -
['alphard']['cron]['group']
- the user used create log file and directory -
['alphard']['cron]['version']
- the cron ubuntu version
Cron Tab
-
['alphard']['cron]['tab'][my_service]
- the service name you want to restart periodically (the restart command will be: 'service my_service restart') -
['alphard']['cron]['tab'][my_service][expression]
- the cron expression -
['alphard']['cron]['tab'][my_service][minute]
- the cron expression minute value -
['alphard']['cron]['tab'][my_service][hour]
- the cron expression hour value -
['alphard']['cron]['tab'][my_service][weekday]
- the cron expression weekday value -
['alphard']['cron]['tab'][my_service][day]
- the cron expression day value -
['alphard']['cron]['tab'][my_service][month]
- the cron expression month value -
['alphard']['cron]['tab'][my_service][randomized]
- default false, if true the service will be restart with the specified delay. Useful fo distributed env and you don't want to restart services at the same time on each machine -
['alphard']['cron]['tab'][my_service][delay]
- the cron maximum delay before restart in seconds -
['alphard']['cron]['tab'][my_service][enabled]
- if true the cron entry will be added to the cron tab, if false the entry will be removed from cron tab
Usage
alphard-cron::default
Include alphard-cron
in your node's run_list
:
{ "name":"my_node", "run_list": [ "recipe[alphard-cron]" ] }
Add attributes for each service you want to restart periodically
default['alphard']['cron']['tab']['cron']['expression'] = '* * * * *'
default['alphard']['cron']['tab']['cron']['randomized'] = true
default['alphard']['cron']['tab']['cron']['delay'] = 60
default['alphard']['cron']['tab']['cron']['enabled'] = true
License
Copyright 2009-2016, Hydra Technologies, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Authors
- Frédéric Nowak - frederic.nowak@alphard.io
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Foodcritic Metric
1.0.0 failed this metric
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/definitions/cron_restart.rb:72
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/definitions/cron_restart.rb:73
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/definitions/cron_restart.rb:80
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/definitions/cron_restart.rb:81
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/definitions/cron_restart.rb:88
FC015: Consider converting definition to a LWRP: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/definitions/cron_restart.rb:1
FC019: Access node attributes in a consistent manner: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/attributes/default.rb:21
FC019: Access node attributes in a consistent manner: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/attributes/default.rb:22
FC019: Access node attributes in a consistent manner: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/attributes/default.rb:23
FC019: Access node attributes in a consistent manner: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/recipes/default.rb:22
FC019: Access node attributes in a consistent manner: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/recipes/default.rb:26
1.0.0 failed this metric
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/definitions/cron_restart.rb:73
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/definitions/cron_restart.rb:80
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/definitions/cron_restart.rb:81
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/definitions/cron_restart.rb:88
FC015: Consider converting definition to a LWRP: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/definitions/cron_restart.rb:1
FC019: Access node attributes in a consistent manner: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/attributes/default.rb:21
FC019: Access node attributes in a consistent manner: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/attributes/default.rb:22
FC019: Access node attributes in a consistent manner: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/attributes/default.rb:23
FC019: Access node attributes in a consistent manner: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/recipes/default.rb:22
FC019: Access node attributes in a consistent manner: /tmp/cook/022ab2d30a56d10f000436e2/alphard-cron/recipes/default.rb:26