To run the script every day at 23:59:00, use the following:
59 23 * * * root /path_to_file_from_root
Seconds cannot be determined using Cron , but it should do it 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 in 58 seconds, just to make sure the script doesn't linger until midnight.
It is very simple, you can make it a little more complicated and run tests to ensure that the script always starts at 23:59:59, getting the time and lingering accordingly. However, this is not necessary.
<?php
source share