Occasionally, I have a maintenance task for one of my programs: something has to be done in the background every so often.
From
rsyncing content between servers to importing data received from external parties into my application.
Most of the products we make run on Linux servers, so I use
cron to make scripts run every x amount of minutes/hours/days/etc.
With most of these small scripts I want the following:
- Locking (so if a script takes particularly long time, it won't be running twice concurrently)
- Logging (Never blindly trust the machine, or a human for that matter, to always do the right thing)
- Cleaning up aformentioned logs (because over time they can grow very fast)