Version information
This version is compatible with:
- Puppet Enterprise 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
- Puppet >= 2.6.0 < 5.0.0
- Archlinux, Gentoo , , ,
Start using this module
Add this module to your Puppetfile:
mod 'torrancew-cron', '0.2.1'
Learn more about managing modules with a PuppetfileDocumentation
Puppet Cron Module
Build Status:
Notes:
This module manages cronjobs by placing a file in /etc/cron.d. It defines the following types:
- cron::job - basic job skeleton
- cron::hourly - wrapper for hourly jobs
- cron::daily - wrapper for daily jobs
- cron::weekly - wrapper for weekly jobs
- cron::monthly - wrapper for monthly jobs
Installation:
Install in your puppet master's modulepath as a directory named 'cron'.
This module can install cron if needed - simply
include cron
Usage:
The name of the job (quoted part after the opening '{' ) is completely arbitrary. However, there can only be one cron job by that name.
cron::job
cron::job creates generic jobs in /etc/cron.d. It allows specifying the following parameters:
- ensure
- minute
- hour
- date
- month
- weekday
- user
- command
- environment
Example: This would run the command "mysqldump -u root mydb" as root at 2:40 AM every day:
cron::job{
'mysqlbackup':
minute => '40',
hour => '2',
date => '*',
month => '*',
weekday => '*',
user => 'root',
command => 'mysqldump -u root mydb',
environment => [ 'MAILTO=root', 'PATH="/usr/bin:/bin"' ];
}
cron::hourly
cron::hourly creates jobs in /etc/cron.d that run once per hour. It allows specifying the following parameters:
- ensure
- minute
- user
- command
- environment
Example: This would run the command "mysqldump -u root mydb" as root on the 20th minute of every hour:
cron::hourly{
'mysqlbackup_hourly':
minute => '20',
user => 'root',
command => 'mysqldump -u root mydb',
environment => "MAILTO=root\nPATH='/usr/bin:/bin'";
}
cron::daily
cron::daily creates jobs in /etc/cron.d that run once per day. It allows specifying the following parameters:
- ensure
- minute
- hour
- user
- command
- environment
Example: This would run the command "mysqldump -u root mydb" as root at 2:40 AM every day, like the above generic example:
cron::daily{
'mysqlbackup_daily':
minute => '40',
hour => '2',
user => 'root',
command => 'mysqldump -u root mydb';
}
cron::weekly
cron::weekly creates jobs in /etc/cron.d that run once per week. It allows specifying the following parameters:
- ensure
- minute
- hour
- weekday
- user
- command
- environment
Example: This would run the command "mysqldump -u root mydb" as root at 4:40 AM every Sunday, like the above generic example:
cron::weekly{
'mysqlbackup_weekly':
minute => '40',
hour => '4',
weekday => '0',
user => 'root',
command => 'mysqldump -u root mydb';
}
cron::monthly
cron::monthly creates jobs in /etc/cron.d that run once per month. It allows specifying the following parameters:
- ensure
- minute
- hour
- date
- user
- command
- environment
Example: This would run the command "mysqldump -u root mydb" as root at 3:40 AM the 1st of every month, like the above generic example:
cron::monthly{
'mysqlbackup_monthly':
minute => '40',
hour => '3',
date => '1',
user => 'root',
command => 'mysqldump -u root mydb';
}
Contributors:
- Kevin Goess (@kgoess) - Environment variable support + fixes
- Andy Shinn (@andyshinn) - RedHat derivatives package name fix
- Chris Weyl (@RsrchBoy) - Fixed Puppet 3.2 deprecation warnings
- Mathew Archibald (@mattyindustries) - Fixed file ownership issues
- Nathan Sullivan (@CpuID) - Support for specifying package version
- The Community - Continued improvement of this module via bugs and patches
TODO:
- Add PuppetDoc markup to manifests
- Add a Modulefile, upload to the Puppet Forge
v0.2.1: 2016-04-30 Changes:
- Fix service support on Archlinux v0.2.0: 2016-04-28 Changes:
- Add support for Ubuntu, Gentoo, Archlinux, RedHat 5
- Allows specifying desired version of cron package
- Allow command to be unset when $ensure = absent
- Puppet v4 Compatibility (file modes are now strings)
- Adds service management
v0.1.0: 2013-08-27 Changes:
- Add support for the "ensure" parameter
v0.0.3: 2013-07-04 Changes:
- Make job files owned by root
- Fix warnings for Puppet 3.2.2
v0.0.2: 2013-05-11 Changes:
- Make mode of job file configurable
v0.0.1: 2013-03-02 Changes:
- Initial PuppetForge release
Copyright 2012-2013 Tray Torrance 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.