Reputation: 13
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?
Upvotes: 1
Views: 2206
Reputation: 609
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!
Upvotes: 1
Reputation: 117
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.
Upvotes: 0
Reputation: 1402
You can use free service like UptimeRobot. It will send you notification when the site is down or back up.
Upvotes: 1
Reputation: 5191
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.
Upvotes: 0