I have a javascript function that runs every minute.
setInterval(function(){ //first, check time, if it is 9 AM, reload the page var now = new Date(); if (now.getHours() == 9 { window.refresh(); } //do other stuff },60000);
Now the problem is that the reboot occurs only once a day. since the function runs every minute, so the next time it lights up, it will reload the page again if it is between 9:00 and 10:00. How to reboot only once?
Perhaps I will do this by creating another interval function that fires every hour and checks if it should be rebooted. but since I already have a function that works every minute, can I do it from there?
If I end up creating another function that checks every hour. What happens if these 2 functions work at the same time?
source share