Using a file to schedule a pause
In this post i want to share how to use a file to schedule a pause for some service or daemon like program.
This idea is from one of my brilliant colleagues. We are using this to pause some services at a specific time. When we have some database changes. These services are running some very long database transactions. To minimize what can go wrong we pause them so they will not do any transaction while we are making database changes.
We are using a file and set a date for that file using touch:
touch -d 12:30 pause
ls –full-time pause
-rw-r–r– 1 root root 0 2020-07-31 12:30:00.000000000 +0200 pause
In our services we then check for the presence of that file. If the file exists we check the date and time and pause the service at that date and time.
The nice thing about using a file is that a file like this is easy to deploy and maintain. It is also fairly simple to understand.