I have a device on my network that is posting data to an html page. I need to be able to collect the data from the page and insert it into my database so I can have historical reference to the data. I am able to use the following command to retrieve the fields from the site. The result returns three numbers separated by a line break.
I would like to run this as a linux cron job, so I would like to use a linux script to:
- save the data (numbers) to variables
- connect to my database and insert the data in a table
My command line to retrieves the information is below. This works great for parsing out the data from the device:
curl -s http://local_device.com/dtm.html?address=C5:0 | grep -Po '[0-9]+(?=[^0-9]+(C5:2<|C5:6<|C5:13))'