Originally Posted by
jc2020
why is your txt files inside crontabs? Should it be the other way around?
The text files aren't inside the crontab. Rather, each filename is supplied as a command line argument to the program that is executed via cron, hence they appear in the crontab after the program name.
Originally Posted by
jc2020
And also why are your numbers being incremented so high. It's suppose to increase by one each day or every 1-5 minutes during testing. (...) So that is cron fault, correct?
This is where the crontab.guru tool comes in handy if you're like me: either too lazy to even parse the syntax yourself, or like to second guess yourself in case of misinterpretation so you want a tool to check it for you.
The tool will tell you that these:
Code:
*/5 * * * *
*/10 * * * *
*/15 * * * *
respectively mean:
Code:
At every 5th minute.
At every 10th minute.
At every 15th minute.
Now, we see that counter1.txt starts at 13 and ends up at 68. 68 - 13 = 55. So we know that the program was run 55 times to update counter1.txt. Since the cronjob is set to run the program at every 5th minute, and the program increments the counter each time it is run, it follows that about 55 * 5 = 275 minutes have elapsed.
Now, 275 / 10 = 27.5. Observe that for counter2.txt, we started at 6 and ended at 34. 34 - 6 = 28, which is consistent with the approximation of 27.5. Likewise, 275 / 15 ~= 18.3. For counter3.txt, we have 23 - 5 = 18, which again is consistent.
In conclusion, cron worked exactly as it should have. It isn't cron's fault, and if you wrote the crontab correctly, it isn't your fault in setting up the cronjob either. This means that the fault might lie with the programs that are being executed via cron.