I hope this is in the right topic area. Sorry if it isn't.
I want to ask the right way to do this task.
I have a few service API's I need to query every 30seconds or so that I would like to store in a mysql table then use this data on a web page.
Now I have done this using a python script to get all the data, format it and update the table and this works fine. Now at the moment I'm using a cron task to run the script every 30 seconds.
My question is: - is cron the right way to run this script in intervals or am I going against best practice? - Am I going about this whole thing completely the wrong way to get API data?
I was thinking about having the script trigger at the bottom of the HTML code, but if multiple people access the page it will trigger the script each time ending in tens if not 100's of python scripts querying the APIs
PS: I have done a search but couldn't see a post that answers this question.
Cheers in advance :-)