Sha256: 41f0f7408bbaf71bc1aacb76b6546c04e5d6edabef4caf88151a55bfbf9a22ae

Contents?: true

Size: 1.46 KB

Versions: 28

Compression:

Stored size: 1.46 KB

Contents

=begin rdoc
== Cron
 
The cron resource will set cron jobs at the intervals you set
 
== Usage
 
  has_cron(:name => '...') do
    # More options.
    # This block is optional
  end
 
== Options
 
* <tt>name</tt> The name of the cronjob
* <tt>user</tt> The users who owns the cronjob  
* <tt>command</tt> The cronjob command to run
* <tt>minute</tt> Set the minute of the cronjob
* <tt>hour</tt> Set the hour of the cronjob
* <tt>month</tt> Set the month of the cronjob
* <tt>monthday</tt> Set the day of the month of the cronjob
* <tt>weekday</tt> Set the weekday of the cronjob, in 0-6 format, where 0 is Sunday
 
== Example
 
  has_cron(:name => "report mailer", :minute => "5", :hour => "0", :weekday => 1) do
    command "/bin/sh /home/user/email_reports.sh"
  end
 
=end
module PoolParty
  module Resources
    
    class Cron < Resource
      
      default_options(
        :minute   => "*",
        :hour     => "*",
        :day      => "*",
        :month    => "*",
        :weekday  => "*",
        :user     => "root",
        :command  => nil
      )
      
      def print_to_chef
        <<-EOE
cron "<%= name || command %>" do
  command "<%= command || name %>"
  action :<%= exists? ? :create : :delete %>
  minute <%= print_variable(minute) %>
  hour <%= print_variable(hour) %>
  day <%= print_variable(day) %>
  month <%= print_variable(month) %>
  weekday <%= print_variable(weekday) %>
  user <%= print_variable(user) %>
end
        EOE
      end
      
    end
    
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
auser-poolparty-1.3.0 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.1 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.10 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.11 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.12 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.13 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.14 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.15 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.16 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.17 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.2 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.3 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.4 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.5 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.6 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.7 lib/poolparty/resources/cron.rb
auser-poolparty-1.3.8 lib/poolparty/resources/cron.rb
fairchild-poolparty-1.3.17 lib/poolparty/resources/cron.rb
fairchild-poolparty-1.3.5 lib/poolparty/resources/cron.rb
poolparty-1.3.15 lib/poolparty/resources/cron.rb