Thursday, March 18, 2010

Centralized Cronjob Management

Managing cronjobs can be easy or it can be hard. When you just have a couple of servers that do specific things, the overhead is minimal. Problems start to come up when your server count starts to grow and/or the complexity of those servers require many timed administrative tasks.

What happens when you have 25 (or 1,000) web servers that need several cronjobs? What happens when you have them zoned with five servers per zone and each zone requires different cronjobs for management?

One possible answer is using a Hudson Continuous Integration Server. Hudson will allow you to schedule jobs to be ran just like any regular crond server. It can also log any output that comes from your jobs so you don't have to pipe them to /dev/null. It can also inform you when a job fails to produce the desired effect.

The question is how do you run cronjobs on remote machines? The primary way I do it is I use the Hudson user that the Hudson server runs as. I then setup ssh keys so that the Hudson user can ssh to other servers without a password. From there, you can setup your script to ssh to the required server before it executes the job that needs to be executed.

Using NFS mounted home directories makes it even more simple. Your scripts will always be where ever you ssh too. It also simplifies setting up ssh keys since every where you go has the same ssh key.

Leveraging the power of centralization is the key to a smooth running operation that is easy to manage. Best of all, it doesn't always require expensive hardware or software.

No comments:

Post a Comment