How to make my system every morning give alert?

0

How can I make my system wake up every morning? I want it all dawn 4 o'clock in the morning for an alert system ("alo world") how do I do it?

    
asked by anonymous 08.11.2017 / 02:58

1 answer

0

With a simple Javascript you can do this, but it is logical that the page should be running.

The endtime variable will store the end time and the checkTime () function will make sure to count the time until the logic is met.

  
    

No need to refresh

  

                    var endtime = "4:00:00";

                    function startTime()
                    {
                        var today=new Date();
                        var h=today.getHours();
                        var m=today.getMinutes();
                        var s=today.getSeconds();
                        // add a zero in front of numbers<10
                        m=checkTime(m);
                        s=checkTime(s);
                        document.getElementById('tempo').innerHTML=h+":"+m+":"+s;
                        var curtime =h+":"+m+":"+s; 
                        t=setTimeout('startTime()',500);
                        if(curtime==endtime)
                        {                   
                            alert("alo mundo");
                        }                       
    
                    }
                    function checkTime(i)
                    {
                        if (i<10)
                        {
                            i="0" + i;
                        }
                        return i;
                    }
                    
                    startTime();
<div id="tempo"></div> 
    
08.11.2017 / 13:29