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

BASH – Web Ping Log

Posted on January 29, 2024August 17, 2024 By David Kittell

Sometimes you need a simple log to know when a site is up or down.

Create a script like below and then put it in your crontab.

#!/bin/bash
echo 'Begin ping'
if ping -c 1 kittell.net &> /dev/null; then
    echo "$(date "+%Y-%m-%d %H.%M.%S") - Success" >> /var/log/web_ping.log
else
     echo "$(date "+%Y-%m-%d %H.%M.%S") - Error" >> /var/log/web_ping.log
fi
sudo crontab -e
# Check every minute
* * * * * /var/scripts/web_ping.sh
Originally Posted on January 29, 2024
Last Updated on August 17, 2024
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 Debian Fedora Mac OS X Shell Mac OSX Raspbian (Raspberry Pi OS) Red Hat Ubuntu UNIX UNIX Shell Scripts Zorin OS

Post navigation

Previous post
Next post

Related Posts

Update Ektron License

Posted on July 19, 2013October 26, 2015

After applying this update you will need to restart the services and in some case restart the server completely. SELECT lic_key FROM Settings SELECT module_license FROM module_licenses UPDATE Settings SET lic_key = ‘<License>’ UPDATE module_licenses SET module_license = ‘<License>’ Originally Posted on July 19, 2013Last Updated on October 26, 2015…

Read More

XML Reader

Posted on October 15, 2013October 26, 2015

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Xml; using System.IO; namespace XMLReader1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { string xmlString = "04228911.xml"; XmlDocument doc = new XmlDocument(); doc.Load(@xmlString);…

Read More

PowerShell – Get Computer Information

Posted on November 6, 2015November 10, 2015

This script is pieced together from various posts, I only take credit for combining the resources. There is more than initially is seen to this script, based on the code below it will write a text file on c:\ and does need admin privileges in order to run. Right around…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • PowerShell - IIS Remove Site
  • SQLite - Auto-Increment / Auto Generate GUID
  • PowerShell - FTP Upload Directory With Sub-Directories

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
  • PowerShell - IIS Remove Site
  • SQLite - Auto-Increment / Auto Generate GUID
  • PowerShell - FTP Upload Directory With Sub-Directories
  • Raspberry Pi - Remove Default Apps
  • PowerShell - Change Windows CD/DVD Drive Letter
©2025 David Kittell | WordPress Theme by SuperbThemes