I am trying to use a file (csv, json, txt, haven't decided format) that I can drop a few lines of data in. A python script will be on cron to run every 5 minutes and check the file if there is anything new and if there is, process it and delete each line as it is processed.
I am trying to prevent a situation where I open the file, make some changes and save it while the process came by grabbed the data and emptied the file but my save writes it back in.
I thought the only way to make this safe is to have it process a folder and just look for new files, all changes would be dropped in a new file. So there is never the risk of this happening.
Is there a better way, or is this the best approach?