Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

UNIX Bash – Website Monitor

Posted on August 23, 2016 By David Kittell
for i in $(curl -s -L cnn.com |egrep --only-matching 'http(s?):\/\/[^ \"\(\)\<\>]*' | uniq)
do
    curl -s -I "$i" 2>/dev/null | head -n 1 | cut -d' ' -f2
done
curl -Is http://www.google.com | head -n 1
HTTP/1.1 200 OK
curl www.websiteToTest.com -s -f -o /dev/null || echo "Website down." | mail -s "Website is down" admin@example.com

Reference: http://unix.stackexchange.com/questions/84814/health-check-of-web-page-using-curl

All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

CentOS Code Fedora Mac OS X Shell Mac OSX Red Hat Ubuntu UNIX UNIX Shell Scripts

Post navigation

Previous post
Next post

Related Posts

PowerShell – FTP Upload Directory With Sub-Directories

Posted on November 23, 2015February 12, 2016

This script below will connect to a FTP server and upload the folder with sub-directories and content to the defined path. Currently this script will assume it needs to create the directories. clear # FTP Server Variables $FTPHost = ‘ftp://192.168.1.1/html/’ $FTPUser = ‘user’ $FTPPass = ‘password’ #Directory where to find…

Read More

Shell and Wait

Posted on December 14, 2013October 26, 2015

Public Sub ShellandWait(ByVal ProcessPath As String) Dim objProcess As System.Diagnostics.Process Try objProcess = New System.Diagnostics.Process objProcess.StartInfo.FileName = ProcessPath objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal objProcess.Start() ‘Wait until the process passes back an exit code objProcess.WaitForExit() ‘Free resources associated with this process objProcess.Close() Catch MessageBox.Show("Could not start process " & ProcessPath, "Error") End Try…

Read More

Basic4Android – Compass Direction

Posted on September 15, 2017

Sub GetCompassDirection(bearing As Double) As String Dim tmp As Int ‘ Set Default Direction Dim direction As String : direction = "N" tmp = Floor(Round(bearing / 22.5)) Select Case tmp Case 1 direction = "NNE" Case 2 direction = "NE" Case 3 direction = "ENE" Case 4 direction = "E"…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes