I have a database that around 8 fields in various tables are dates and these need to be checked everyday for if they are about to or have already expired.
I want to use a CRON Job to achieve this, but baring in mind that the database will eventually have 50,000 rows possibly more. Running a script that checks all of the dates would most likely time out.
I was thinking of segmenting the search script into chunks. So it will run for a few thousand rows then stop. Then five minutes later pick up from where it left of, by querying a field in the database that stores where it last finished. And once it has iterated through all rows stop.
But I don’t know if this is wise or even possible for a script to set itself to run again in 5 minutes.
Any advice would be appreciated.
You wouldn’t have to run over the complete table. You could just run a query for that right?