![]() ![]() I know, this is far more work to implement, but it is the better way to do it. php sleep 1 minute php sleep milliseconds php sleep half a second sleep in php microseconds php pause loop wait in php script php delay TPC Matrix View Full. Even if the server crashes and restarts, as long as the database is intact and the script runs again, everything should go as planned. Then that script could do this for you with an accurary of about a minute, which should be enough. How would that work? Suppose you execute a PHP script every minute, and you have a database entry that tells you which resource to allocate at a certain start time and deallocate at a certain expire time. I would start with 3590 seconds and make sure that always works.įinally: What are the alternatives? Clearly this could be a cron job. You have to leave some time for DigitalOcean to execute stuff and log the time. at 20:57 Synaps My pattern is to simply run this script every 30 seconds without stopping it by any means tomtam at 20:57 As Svetlio already mentioned: There will be some cron (tab) system task that cleans your processes. Then there's the problem that you want to sleep for exactly 3599 seconds, so that you're only charged one hour. This is under the assumption that FALSE is -1. A better sleep would be: $remainingTime = 3590 Not much you can do about that, given this script.Īlso, the sleep() itself might get interrupted, causing it to sleep much shorter than you want. I am worried that the script might get interrupted, and you will never delete the droplet. It sleeps for the given number of seconds. Note that sleep() should not have $time as an argument. You would need to make sure your script can run, at least, for that long. It doesn't look like a good idea, but the code is so simple, nothing can compete with that. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |