title: Cron to check dates in large MySQL database
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>But I don't know if this is wise or even possible for a script to set itself to run again in 5 minutes.</p>
  
  <p>Any advice would be appreciated.</p>