Simple and efficient cron management
Keeping track of scheduled cron jobs is not always the easiest thing to do with Puppet — especially if you are managing systems that other people may have added their own cron jobs to, whether that be within the cron configuration files or in an individual user’s crontab.
Equally difficult is managing a plethora of servers and being responsible for performing and maintaining the backups for all of them. A small part of this includes dumping MySQL databases into a portable format on a regular basis.
Puppet makes both of these tasks easy. So, in order to get the backups running via cron, let’s explore some options.
Managing cron jobs
Keeping tabs on your cron jobs (no pun intended) is actually a lot simpler than one would think with Puppet. However it took me a few go’s at implementation before I came to a sound solution.
The first thing I tried was using Puppet’s built-in cron class, like this:
cron { "dbdump":
command => "/usr/local/sbin/dbdump",
user => "root",
hour => 0,
minute => 0
}
As you see, I created a script called dbdump to be run by this cron entry. It is a simple bash script that performs a “SHOW DATABASES;”, loops through them, and dumps them all to flat text files utilizing mysqldump.
(more…)