How to configure CRON to run every 10 seconds on Linux?

I need to run a task CRONevery 10 seconds from the moment it starts.

On Linux, how to run a task CRONevery 10 seconds from the moment it starts?

I try to do as the following-

when I make a request (or start) at 04:28:34, it should start at 04:28:44 and not at 4:28:40

This is what I did and I try

# m h  dom mon dow   command
*/10 * * * * /usr/bin/wget http://api.us/application/

What have I done here to not work every 10 seconds?

+24
source share
2 answers

To clarify Sougata Bose's answer, I think the OP wants the command to run every 10 seconds from the moment it starts; not 10 seconds after the first minute and each subsequent minute.

cron 1 ( , , , unix).

, , 60 /10 = 6 , .

crontab -e :

* * * * * ( /usr/bin/wget http://api.us/application/ )  
* * * * * ( sleep 10 ; /usr/bin/wget http://api.us/application/ )  
* * * * * ( sleep 20 ; /usr/bin/wget http://api.us/application/ )  
* * * * * ( sleep 30 ; /usr/bin/wget http://api.us/application/ )  
* * * * * ( sleep 40 ; /usr/bin/wget http://api.us/application/ )  
* * * * * ( sleep 50 ; /usr/bin/wget http://api.us/application/ )  
+42

*/10 . Cron , , . -

* * * * * ( sleep 10 ; /usr/bin/wget http://api.us/application/)

10 .

+6

All Articles