LogoopenSUSE Build Service > Projects
Sign Up | Log In

Run Cron Job with Overrun Protection

When doing network monitoring, it's common to run a cron job every five minutes (the standard interval) to roam around the network gathering data. Smaller installations may have no trouble running within this limit, but in larger networks or those where devices are often unreachable, running past the five-minute mark could happen frequently.

The effect of running over depends on the nature of the monitoring application: it could be of no consequence or it could be catastrophic. What's in common is that running two jobs at once (the old one which ran over, plus the new one) slows down the new one, increasing the risk that it will run long as well. This is commonly a cascading failure which can take many polling sessions to right itself, which may include lost data in the interim.

Our response has been to create this tool, lockrun, which serves as a protective wrapper. Before launching the given command, it insures that another instance of the same command is not already running.

Source Files

Filename Size Changed Actions
lockrun.c 6.55 KB Download File
lockrun.spec 1.83 KB Download File

Comments for home:zhonghuaren (0)

Login required, please login or signup in order to comment