Support Wikipedia

Friday, May 22, 2009

Watch and Curl

Watch is a utility I have already discussed in my earlier post. I want to bring your attention to this nifty little utility called curl. It is basically a program to hit a URL and get data from it. There are hundreds of arguments that it can take. I won't be going into all that. I use it just as a tool to get data from a URL and here I combine it with the watch program to repeatedly execute the URL and also see the visible difference(s) in the output response from the URL.

The command used here is
watch -d -n 60 'curl "http://localhost:81/myapp/data/get-sample?userID=abc&password=foo"'

The output produced is shown below....

Where the highlighted text is what has changed in the output during the last time interval (which is 60 seconds in this case).