0

In my website I want that every day in a specific hour the server will run a function, and in every few minutes run other function.

While the second one is easy, (hosting the time of the last update in the DB, and in every page refresh see how much time passed, divide it with the amount of minutes, use floor, and then I know how much times I should run the function), I have no idea what to do with the first function. The hour might be changed, so I can't just check how much times 24 hours passed.

What can I do?

Thanks!

  • possible duplicate of [Are There Any Cron Jobs Alternative?](http://stackoverflow.com/questions/4662048/are-there-any-cron-jobs-alternative) – r3mainer Jun 25 '15 at 08:55
  • @squeamishossifrage No, because here the time is changing. It's not every 2 minutes, it's every `$min` minutes. It's not every day and 20:00, it's every day at `$hour`:00 –  Jun 25 '15 at 09:01
  • 1
    So run `cron.php` every hour on the hour, and in `cron.php`, fetch the value of `$h` from wherever you stored it, and compare with the current time. If an action is scheduled, do it. Otherwise do nothing. – r3mainer Jun 25 '15 at 09:05

0 Answers0