Combining crontab with fcrontab, timer and schedule


New Member
Sep 6, 2021
Reaction score
Hello, I wasn't sure if this is the right forum. Here is the question

Having 2 schedules set:
1. Cron running every 8am
0 8 * * *
2. Fcron running every 61 minutes:

They will eventually bump into each other and it will not work because only one job can be run at a time. To avoid this issue we might use a lock to allow only one job at a time, such as this code here
0 8 * * * user/bin/flock /usr/tmp/lfile.lockfile -c ''
@ 1h1 user/bin/flock /usr/tmp/lfile.lockfile -c ''

This rises another issue, if fcron is configured to run every 61 minutes and when it starts and will wait for the other job to finish, the timer will be misaligned because the next time it runs, will be

(61 minutes - the time it had a lock on) It is required that the runs after 60 minutes

1. Cron job starts at 8am and runs for 5 minutes
2. Fcron is about to start at 8:01am too but it had noticed the lock is in place
3. Fcron waits for Cron job to finish
4. Fcron finally runs at 8:05am
5. Fcron will run 61 minutes from 8:01am which will result in next iteration to start at 9:02am instead of expected 9:06am

If you think you have solution, please let me know
$100 Digital Ocean Credit
Get a free VM to test out Linux! Hosting Donations
Consider making a donation

Members online