I am working on a fairly large project written in PHP (Yii2) in which we are increasingly using cron for background tasks, such as generating caches, reports, etc.
We have started to move the hourly timings by a few minutes so that they don't overlap, but I don't know if this is a good idea.
Besides, I have noticed that it is becoming increasingly difficult to maintain such a file
Do you have any advice, ideas on how to improve it, change it ?
I was thinking of combining cron with a queuing system (RabbitMQ) so that cron would call tasks at a certain time but they would go to RabbitMQ. This would prevent tasks from overlapping.
I wonder if this makes sense.
Below is a sample piece of cron:
1 4 * * * yii task1
1 5 * * * yii task2
1 8,17 * * * yii task3
10 9,17 * * * yii task4
30 9,17 * * * yii task5
*/4 * * * * yii task6
*/15 * * * * yii task7
5 10,14,17 * * * yii task8
50 * * * * yii task9
5 * * * * yii task10
10 * * * * yii task11
15 * * * * yii task12
10 0 * * * yii task13
10 3 * * * yii task14
30 4 * * * yii task15
30 0 * * * yii task16
40 5 * * * yii task17
40 7 * * 1-5 yii task18
30 22 * * * yii task19
59 23 * * * yii task20
7 6-16,23 * * 1-5 yii task21
5 3 * * * yii task22
*/10 6-22 * * * yii task23
*/15 6-22 * * * yii task24
*/5 6-22 * * * yii task25
0 6-22 * * 1-5 yii task26
20 5 * * 1-5 yii task27