'Reload cron when cron file gets mounted on

I'm working with an HA cluster on Centos 7. I use Pacemaker for failover. When a node becomes master a filesystem gets mounted on it. The location in which the filesystem gets mounted contains a cron file. The new directory also contains a cron file (has the same path as the old one). This path is symlinked to /var/spool/cron/root.

My problem is - the "before" and "after" cron files are different, so I need a cron reload. How can I make the cron reload automatically upon this mounting event?

What I already tried/know:

  • The usual reloading upon file change doesn't work here, because the symlink pointing to the location remains the same and this is what crontab cares about.
  • I tried creating a script monitoring the symlink with inotifywait. This picks up on the changes to the file the symlink points to but stays oblivious to the mount/umount event, doesn't register it in any way.
  • I'm thinking about using the Pacemaker alerts to run a script reloading the crontab upon an event. Didn't try that yet, I have some troubles with its documentation. I can't figure out how to make an alert run only on failovers after the mounting is done. (If you think this approach can work, I would appreciate some tips, I don't have experience with that tool)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source