{"id":10553,"date":"2026-06-12T10:04:26","date_gmt":"2026-06-12T08:04:26","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=10553"},"modified":"2026-06-12T10:04:27","modified_gmt":"2026-06-12T08:04:27","slug":"how-to-create-a-simple-website-uptime-monitor-using-ssh-and-cron","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-create-a-simple-website-uptime-monitor-using-ssh-and-cron\/","title":{"rendered":"How to Create a Simple Website Uptime Monitor Using SSH and Cron"},"content":{"rendered":"\n<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">Monitoring your website&#8217;s availability helps you identify outages and service issues before your visitors report them. While many third-party monitoring services are available, you can also create a simple uptime monitoring solution using SSH access, a shell script, and a scheduled cron job.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This approach allows you to periodically check your website and send notifications to services such as Discord or Slack when a problem is detected.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-create-a-simple-website-uptime-monitor-using-ssh-and-cron\/#Before_You_Begin\" >Before You Begin<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-create-a-simple-website-uptime-monitor-using-ssh-and-cron\/#Step_1_Create_a_Webhook\" >Step 1: Create a Webhook<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-create-a-simple-website-uptime-monitor-using-ssh-and-cron\/#Discord\" >Discord<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-create-a-simple-website-uptime-monitor-using-ssh-and-cron\/#Slack\" >Slack<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-create-a-simple-website-uptime-monitor-using-ssh-and-cron\/#Step_2_Connect_via_SSH\" >Step 2: Connect via SSH<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-create-a-simple-website-uptime-monitor-using-ssh-and-cron\/#Step_3_Create_the_Monitoring_Script\" >Step 3: Create the Monitoring Script<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-create-a-simple-website-uptime-monitor-using-ssh-and-cron\/#Step_4_Make_the_Script_Executable\" >Step 4: Make the Script Executable<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-create-a-simple-website-uptime-monitor-using-ssh-and-cron\/#Step_5_Schedule_Automatic_Checks\" >Step 5: Schedule Automatic Checks<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-create-a-simple-website-uptime-monitor-using-ssh-and-cron\/#Understanding_the_Script\" >Understanding the Script<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-create-a-simple-website-uptime-monitor-using-ssh-and-cron\/#Possible_Improvements\" >Possible Improvements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-create-a-simple-website-uptime-monitor-using-ssh-and-cron\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Before_You_Begin\"><\/span>Before You Begin<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<\/div>\n\n<div id=\"mybox-1292630091\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Early access<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Still need help?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contact our customer service team.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Message us<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">You will need:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SSH access to your hosting account<\/li>\n\n\n\n<li>Cron job support<\/li>\n\n\n\n<li>A Discord or Slack webhook URL<\/li>\n\n\n\n<li>Basic familiarity with the Linux command line<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_1_Create_a_Webhook\"><\/span>Step 1: Create a Webhook<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Discord\"><\/span>Discord<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To create a Discord webhook:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open your Discord server settings.<\/li>\n\n\n\n<li>Navigate to <strong>Integrations<\/strong> \u2192 <strong>Webhooks<\/strong>.<\/li>\n\n\n\n<li>Create a new webhook.<\/li>\n\n\n\n<li>Select the target channel.<\/li>\n\n\n\n<li>Copy the generated webhook URL.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Slack\"><\/span>Slack<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To create a Slack webhook:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open your Slack workspace settings.<\/li>\n\n\n\n<li>Enable <strong>Incoming Webhooks<\/strong>.<\/li>\n\n\n\n<li>Create a new webhook.<\/li>\n\n\n\n<li>Select the destination channel.<\/li>\n\n\n\n<li>Copy the webhook URL.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Keep this URL secure, as anyone with access to it can send messages to the configured channel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_2_Connect_via_SSH\"><\/span>Step 2: Connect via SSH<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Connect to your hosting account:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh username@yourdomain.com\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to your home directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create a new script:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano uptime_monitor.sh\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_3_Create_the_Monitoring_Script\"><\/span>Step 3: Create the Monitoring Script<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Paste the following script into the file and adjust the configuration values:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\nURL=\"https:\/\/yourdomain.com\"\nWEBHOOK_URL=\"https:\/\/your-webhook-url\"\nPLATFORM=\"discord\"\n\nSTATUS=$(curl -s -o \/dev\/null -w \"%{http_code}\" --connect-timeout 10 \"$URL\")\n\nif &#91; \"$STATUS\" -ne 200 ]; then\n    MESSAGE=\"Website check failed for $URL. HTTP status: $STATUS\"\n\n    if &#91; \"$PLATFORM\" = \"discord\" ]; then\n        PAYLOAD=\"{\\\"content\\\": \\\"$MESSAGE\\\"}\"\n    else\n        PAYLOAD=\"{\\\"text\\\": \\\"$MESSAGE\\\"}\"\n    fi\n\n    curl -H \"Content-Type: application\/json\" \\\n         -X POST \\\n         -d \"$PAYLOAD\" \\\n         \"$WEBHOOK_URL\" &gt;\/dev\/null 2&gt;&amp;1\nfi\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save the file and exit the editor.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_4_Make_the_Script_Executable\"><\/span>Step 4: Make the Script Executable<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Grant execution permissions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod +x uptime_monitor.sh\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can run the script manually to verify it executes successfully:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/uptime_monitor.sh\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the website returns HTTP status code 200, no notification will be sent.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_5_Schedule_Automatic_Checks\"><\/span>Step 5: Schedule Automatic Checks<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Open your user crontab:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>crontab -e\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following line to execute the script every five minutes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>*\/5 * * * * \/home\/username\/uptime_monitor.sh\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace the path with the actual location of your script.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Save and exit the editor.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The monitoring process will now run automatically at five-minute intervals.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Understanding_the_Script\"><\/span>Understanding the Script<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The script relies on several useful curl options:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Option<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>-s<\/code><\/td><td>Runs curl in silent mode<\/td><\/tr><tr><td><code>-o \/dev\/null<\/code><\/td><td>Discards the page content<\/td><\/tr><tr><td><code>-w \"%{http_code}\"<\/code><\/td><td>Outputs only the HTTP response code<\/td><\/tr><tr><td><code>--connect-timeout 10<\/code><\/td><td>Stops waiting after 10 seconds<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This allows the script to quickly determine whether the website is responding normally without downloading the entire page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Possible_Improvements\"><\/span>Possible Improvements<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once the basic monitoring is working, you can expand it further:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Monitor multiple websites from a single script<\/li>\n\n\n\n<li>Alert only after multiple consecutive failures<\/li>\n\n\n\n<li>Check for specific page content instead of only HTTP status codes<\/li>\n\n\n\n<li>Log outages to a file for reporting purposes<\/li>\n\n\n\n<li>Monitor additional services such as APIs, databases, or application endpoints<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Using SSH, cron jobs, and webhooks, you can create a lightweight uptime monitoring system that automatically checks your website and sends notifications when problems occur.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While this approach is not a replacement for enterprise monitoring platforms, it can provide a simple and effective way to keep track of website availability using tools already available on most hosting accounts.<\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[54],"manual_kb_tag":[4275,4276,4277,4278,4279,4280,4281,4282,4283,4284],"class_list":["post-10553","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-ssh","manual_kb_tag-website-uptime-monitoring","manual_kb_tag-uptime-monitoring-script","manual_kb_tag-cron-job","manual_kb_tag-cron-scheduling","manual_kb_tag-bash-script","manual_kb_tag-shell-script","manual_kb_tag-linux-command-line","manual_kb_tag-webhook-notifications","manual_kb_tag-discord-webhook","manual_kb_tag-slack-webhook"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/10553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/10553\/revisions"}],"predecessor-version":[{"id":10554,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/10553\/revisions\/10554"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/media?parent=10553"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manualknowledgebasecat?post=10553"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb_tag?post=10553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}