I am about to trigger a call to a PHP file via curl in a schedule basis. I am thinking of having the script to be executed every 23:59:59 or simply a minute before the day turns tomorrow. Any best approach for this? Quite confused still on the cron settings.
I need to ensure that I run at exactly a second before the next day.
To Execute a script every day at 23:59:00, use the following:
Seconds cannot be defined using Cron, but this should do for you.
To execute the script at 23:59:59, use the PHP
sleep()function to delay the execution of the script by 59 seconds. I would advise 58 seconds though, just to make sure the script doesn’t delay until after midnight.This is very basic, you could make it a little more complex and run tests to ensure that the script is always run at 23:59:59 by retrieving the time and delaying appropriately. This should not be necessary though.