I have a Unix script which is called by a scheduler (CTRL M) every 3 seconds. The script queries an external database(not belonging to my application and therefore I can only query it) to check for new records. Currently it stores the last run timestamp in a local table and on the next poll queries the external database for all records > timestamp. Now I want to avoid updating and querying this local table. The only option I see is to store and read this timestamp in a file.However chances of the file getting corrupted or overriden are higher than data in a database. Google had lot of java options but I need this in a script.
Is there any better way to store the timestamp or better design for the functionality as a whole?