Skip to content

Instantly share code, notes, and snippets.

@mikebannister
Created July 6, 2011 16:24
Show Gist options
  • Save mikebannister/1067661 to your computer and use it in GitHub Desktop.
Save mikebannister/1067661 to your computer and use it in GitHub Desktop.
#
# Cookbook Name:: crontab
# Definition:: crontab
#
#sets the crontab for a user
define :crontab, :username => :root, :filename => nil do
filename = params[:filename]
username = params[:username]
crontabfile = "/tmp/chef-crontab-#{filename}"
template "crontab" do
path crontabfile
source filename
mode 0655
variables(variables)
end
execute "crontab" do
command "crontab -u #{username} #{crontabfile}"
action :run
timeout 60
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment