summaryrefslogtreecommitdiff
path: root/lib/chef/resource/cron_d.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/resource/cron_d.rb')
-rw-r--r--lib/chef/resource/cron_d.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/chef/resource/cron_d.rb b/lib/chef/resource/cron_d.rb
index c9bc8fcb1d..115f60973f 100644
--- a/lib/chef/resource/cron_d.rb
+++ b/lib/chef/resource/cron_d.rb
@@ -26,6 +26,48 @@ class Chef
introduced "14.4"
description "Use the cron_d resource to manage cron definitions in /etc/cron.d. This is similar to the 'cron' resource, but it does not use the monolithic /etc/crontab file."
+ examples <<~DOC
+ To run a program on the fifth hour of the day
+ ```ruby
+ cron_d 'noop' do
+ hour '5'
+ minute '0'
+ command '/bin/true'
+ end
+ ```
+ To run an entry if a folder exists
+ ```ruby
+ cron_d 'ganglia_tomcat_thread_max' do
+ command "/usr/bin/gmetric
+ -n 'tomcat threads max'
+ -t uint32
+ -v '/usr/local/bin/tomcat-stat
+ --thread-max'"
+ only_if { ::File.exist?('/home/jboss') }
+ end
+ ```
+ To run an entry every Saturday, 8:00 AM
+ ```ruby
+ cron_d 'name_of_cron_entry' do
+ minute '0'
+ hour '8'
+ weekday '6'
+ mailto 'admin@example.com'
+ action :create
+ end
+ ```
+ To run an entry at 8:00 PM, every weekday (Monday through Friday), but only in November
+ ```ruby
+ cron_d 'name_of_cron_entry' do
+ minute '0'
+ hour '20'
+ day '*'
+ month '11'
+ weekday '1-5'
+ action :create
+ end
+ ```
+ DOC
# validate a provided value is between two other provided values
# we also allow * as a valid input