Managing cron jobs with Pacemaker

It's not uncommon in Pacemaker clusters to run specific cron jobs only on a node that currently runs a particular resource. The ocf:heartbeat:symlink resource agent can be exceptionally helpful in this situation. Here's how to use it.

Suppose you've got a cron job for Postfix whose definition normally lives in /etc/cron.d/postfix. All your Postfix related data is in a mountpoint /srv/postfix (that filesystem could live on iSCSI, or DRBD, or it could be a GlusterFS mount – that's irrelevant for the purposes of this discussion). And as such, you've moved your cron definition to /srv/postfix/cron.

Now you want that cron job to execute only on the node that also is currently the active Postfix host. That's not hard at all: