Run cURL every 5 seconds

This is the command I want to run -

curl --request POST --data-binary @payload.txt --header "carriots.apiKey:XXXXXXXXXXXXXXXXXXXX" --verbose http://api.carriots.com/streams 

This basically sends the data stream to the server.

I want to run this command every 5 seconds. How to achieve this?

+7
linux curl libcurl
source share
1 answer

You can run the while loop.

 while sleep 5; do cmd; done 

Edit:

If you do not want to use while..loop . you can use the watch command .

 watch -n 5 cmd 
+13
source share

All Articles