Reputation: 1990
I'm trying to run my PHP script on linux server once a day automatically without having to press something, only once and process keeps running till a specific date,
How do I do this WITHOUT making a high traffic load on the server?
what i did so far is using ignore_user_abort()
function to keep it running and also using sleep()
function in a while loop to check every specific time how much left for the next day but it seemed a high process for the server
What's the easiest way to do this?
Upvotes: 1
Views: 354
Reputation: 213
00 11 * * * /usr/local/bin/php /home/you/your_script.php
This is a cron job that will run your script at 11:00 AM everyday.
Upvotes: 1
Reputation: 39522
If you're using a Linux server, there's a much easier way. Simply create a cron job (tutorial) to run the script once a day.
I've never used it, but a Windows server should have something called "Task Scheduler" to do the same thing.
Upvotes: 3