Unverified Commit bd44ef92 authored by Tim Smith's avatar Tim Smith Committed by GitHub
Browse files

Merge pull request #110 from tomdoherty/master

Cleanup prior to importing into chef/chef
parents 1d68b8d2 f1f5425d
......@@ -28,10 +28,6 @@ Installs the cron package and starts the crond service.
The `cron_d` custom resource can be used to manage files in `/etc/cron.d`. It supports the same interface as Chef's built-in `cron` resource:
Note: FreeBSD does not support cron.d functionality, so this cookbook emulates that functionality. cron fragments are created in /etc/cron.d, then they are concatenated together into /etc/crontab. FreeBSD puts some core OS functionality into /etc/crontab, so the original file is copied to /etc/crontab.os_source, and included in the concatenation.
Note: This resource does not function on Solaris platforms due to lack of support for /etc/cron.d. It's possible that the emulation method used in FreeBSD could be modified to work on Solaris as well given help from the community.
#### Properties
- `minute`, `hour`, `day`, `month`, `weekday` - schedule your cron job. These correspond exactly to their equivalents in the crontab file. All default to "*".
......
......@@ -37,12 +37,3 @@ default['cron']['service_name'] = case node['platform_family']
else
'cron'
end
# I think we can add Solaris to this list, but I don't have a Solaris box to test on.
# If so, remove the fail() in providers/d.rb
default['cron']['emulate_cron.d'] = case node['platform_family']
when 'freebsd'
true
else
false
end
......@@ -23,27 +23,3 @@ service 'cron' do
service_name node['cron']['service_name']
action [:enable, :start]
end
# Some platforms (FreeBSD, Solaris) don't support /etc/cron.d, so we have to fake it.
if node['cron']['emulate_cron.d']
directory '/etc/cron.d' do
mode '0755'
owner 'root'
group node['root_group']
end
remote_file '/etc/crontab.os_source' do
source 'file:///etc/crontab'
owner 'root'
group node['root_group']
mode '0444'
action :create_if_missing
end
template '/etc/crontab' do
source 'crontab.erb'
owner 'root'
group node['root_group']
mode '0644'
end
end
......@@ -2,7 +2,7 @@
# Cookbook:: cron
# Resource:: d
#
# Copyright:: 2008-2017, Chef Software, Inc.
# Copyright:: 2008-2018, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -55,8 +55,6 @@ property :environment, Hash, default: {}
property :mode, [String, Integer], default: '0644'
action :create do
# We should be able to switch emulate_cron.d on for Solaris, but I don't have a Solaris box to verify
raise 'Solaris does not support cron jobs in /etc/cron.d' if node['platform_family'] == 'solaris2'
create_template(:create)
end
......@@ -69,12 +67,10 @@ action :delete do
file 'legacy named cron.d file' do
path "/etc/cron.d/#{new_resource.name}"
action :delete
notifies :create, 'template[/etc/crontab]', :delayed if node['cron']['emulate_cron.d']
end
file "/etc/cron.d/#{sanitized_name}" do
action :delete
notifies :create, 'template[/etc/crontab]', :delayed if node['cron']['emulate_cron.d']
end
end
......@@ -88,7 +84,6 @@ action_class do
file "#{new_resource.name} legacy named cron.d file" do
path "/etc/cron.d/#{new_resource.name}"
action :delete
notifies :create, 'template[/etc/crontab]', :delayed if node['cron']['emulate_cron.d']
only_if { new_resource.name != sanitized_name }
end
......@@ -114,7 +109,6 @@ action_class do
environment: new_resource.environment
)
action create_action
notifies :create, 'template[/etc/crontab]', :delayed if node['cron']['emulate_cron.d']
end
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment