How to implement the linux timing task crontab every ten seconds?

linux wants to implement a scheduled task crontab to execute every ten seconds, but the minimum time for automatic execution is minutes. It is said on the Internet that the realization of seconds is foggy, how to achieve

Mar.06,2021

*****command 

* * * * * sleep 10 curl http://xxxx.com

  1. write a script, loop 6 times, each cycle is to execute your task and sleep for 10 seconds, and your task will be executed once every minute at 0s 10s 20s 30s 40s 50s
  2. add 6 crontab,

    * command
    * sleep 10; command
    -sharp and so on

  3. or write an infinite loop in the script without crontab, at all, which is the same as 1

these methods have a disadvantage: when the execution time of your command is more than 10s, it will cause the delay of the next execution. You can put the command in the background to execute

.

PS: codeshelper's markdown editor sucks. Let's take a look at it

Menu