Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Run cURL command every 5 seconds

Writer Mia Lopez

This is the command that I want to run -

curl --request POST --data-binary @payload.txt --header "carriots.apiKey:XXXXXXXXXXXXXXXXXXXX" --verbose 

This basically sends a data stream to a server.

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

2 Answers

You can run in while loop.

while sleep 5; do cmd; done

Edit:

If you don't want to use while..loop. you can use watch command.

watch -n 5 cmd
4

Another simple way to accomplish the same task is:

watch -n {{seconds}} {{your-command}}

For example, every 900 milliseconds (note the double quotes around "your-command"):

watch -n 0.9 "curl '"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy