dzmitry@mycomp:~$ crontab -l SHELL=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin MAILTO=dzmitry */15 * * * * play --no-show-progress --null --channels 1 synth 3 sine 2000; date >> checktime dzmitry@mycomp:~$ 

Result in 3 hours:

 Sat Jul 30 16:30:05 MSK 2016 Sat Jul 30 16:46:36 MSK 2016 Sat Jul 30 17:00:05 MSK 2016 Sat Jul 30 17:22:31 MSK 2016 Sat Jul 30 17:30:04 MSK 2016 Sat Jul 30 17:45:09 MSK 2016 Sat Jul 30 18:00:10 MSK 2016 Sat Jul 30 18:16:34 MSK 2016 Sat Jul 30 18:30:04 MSK 2016 Sat Jul 30 18:56:45 MSK 2016 Sat Jul 30 19:05:18 MSK 2016 Sat Jul 30 19:15:38 MSK 2016 Sat Jul 30 19:30:04 MSK 2016 

Why is the recording not strictly once every 15 minutes? For example, executionN: 18:30:04, executionN + 1: 18:56:45, difference: 26 (twenty six) minutes

  • I see the execution strictly once every fifteen minutes. not at 14 and not at 16. please clarify what the issue is. in a different number of seconds? so crond does not guarantee “accurate time signals”. for this you need something else to use. - aleksandr barakin
  • one
    Possible duplicate question: How to run the script at the exact time? - aleksandr barakin
  • Well, let's say the third execution was at 17:00, and the fourth at 17:22. The difference is 22 minutes. Or here at 18:30, and the next at 18:56. The difference in 26 minutes - pynix
  • This is not an error or an incorrect program behavior. “Time signals” crond does not guarantee. if you need exactly “time signals”, then pay attention to the question, the link to which is slightly higher. - aleksandr barakin
  • Those. if it is indicated to perform once every 15 minutes, and sometimes it is performed once every 22 minutes, sometimes every 26 minutes, sometimes every 10 minutes, is everything normal? - pynix pm

2 answers 2

Swapping, busy audio devices, undetected reboots, various hdd brakes, OS glitches and other similar factors may well influence crontab.

author:> You seem to be right. I overloaded the computer, did not include any programs, left it for three hours. Result: commands are executed at the required frequency with an accuracy of one second.

We found out from the comments that it was to blame, as a result there was a browser and ubuntu 14.04, which together and maliciously blocked the launch of play until the end of the video playback. Further investigation may show us all the ins and outs of this dirty game.

    Since you set the time record after the command is executed, your team is possible and it takes so long.

    • The play command should run through a 2kHz signal with a duration of 3 seconds. If you just enter it, then it happens - pynix
    • Are you sure that you didn’t have any swapping, rebuses, busy audio devices, etc.? - strangeqargo 6:55 pm
    • one
      @strangeqargo you seem right. Overloaded the computer, did not include any programs, left for three hours. Result: the execution of commands with the necessary frequency to within one second - pynix
    • one
      @strangeqargo, everything seems to have figured it out. The point is in the browser. My background is playing music from YouTube. When she plays, there is no call. When the video stops, for example, it changes , the call that should have been played at one time plays at that moment. Moreover, if several signals should have already been heard, then after the video is stopped, everything sounds and is written to the log file - pynix
    • hey, I suspected something like that. Adishche of course. And what kind of Linux do you have (if Linux)? If you change the command to /15 * * * * play --no-show-progress --null --channels 1 synth 3 sine 2000 & ; date >> checktime /15 * * * * play --no-show-progress --null --channels 1 synth 3 sine 2000 & ; date >> checktime In theory, it will be executed in the background, but not the fact that it will sound. But the log should be the correct time. - strangeqargo