1

So, I'm currently using A system where I can manually say if the website is online or not; but I don't see this as "Efficient" because I won't be there 24/7. So I was wondering if there was a way to check if their website is online or not and then create a file on a server as soon as it goes down?

Jon P
  • 19,442
  • 8
  • 49
  • 72
Sonny
  • 13
  • 5
  • There is no way to check internally if a site is online or not. What can the server do if it crashes or down? The answer is: not a lot. Generally you use an external service for this. [DotComMonitor](https://www.dotcom-monitor.com/) is just one example of such a service. – Jon P Aug 28 '18 at 04:45

4 Answers4

1

You can use free service like UptimeRobot. It will send you notification when the site is down or back up.

Roman Svitukha
  • 1,302
  • 1
  • 12
  • 22
1

I wrote simple script in python. Script simple check website status. Here is a link, maybe help You.

Script simple check site code response. If status code is ok - 200 then do nothing. If status code is different than 200, send email notification to declared addresses in config.ini.

Finaly, in crontab I create a log file with site statuse.

1 * * * * /usr/bin/python3 /scripts/WebPageStatusCheck/main.py >> /scripts/WebPageStatusCheck/log/WebPageStatusCheck.log 2>&1

Here check page status and return site status to main.py

import urllib.request


class CheckSiteStatus:
    def __init__(self):
        pass

    @staticmethod
    def check_site_url(url: str):
        url = 'http://' + url
        status = urllib.request.urlopen(url).getcode()
        return status

With best regards!

0

You check it using

1:Ping your website

2:Go here and enter your website url to check availability

Make sure that your site is live on server.

Community
  • 1
  • 1
TAHA SULTAN TEMURI
  • 4,031
  • 2
  • 40
  • 66
  • I know if its online or not but the website does not detect if it's online or not and I was wondering if there was a way that automatically detected it and created a file on the server. – Sonny Aug 28 '18 at 04:40
0

Depends on the technology you are using for your website, you can program events when site goes up or down. Look at this for example of shutdown event in ASP.NET.

Shai
  • 117
  • 6
  • 19