Skip to content

Instantly share code, notes, and snippets.

@manhdaovan
Last active October 5, 2021 07:04
Show Gist options
  • Save manhdaovan/41a8fcb0fb1eab5930725df18185d16f to your computer and use it in GitHub Desktop.
Save manhdaovan/41a8fcb0fb1eab5930725df18185d16f to your computer and use it in GitHub Desktop.

Revisions

  1. manhdaovan revised this gist Oct 5, 2021. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions check_probe.sh
    Original file line number Diff line number Diff line change
    @@ -4,17 +4,17 @@
    # using cURL with HTTP GET method.

    url=$1
    RED='\033[0;31m'
    GREEN='\033[0;32m'
    TXT_RED='\033[0;31m'
    TXT_GREEN='\033[0;32m'

    # check until pressing Ctr+C
    echo "[$(date +%s)] Start checking probation for url: $url"
    while true; do
    if ! curl --max-time 1 --output /dev/null --silent --fail $url &> /dev/null
    then
    printf "${RED}[$(date +%s)] F\n"
    printf "${TXT_RED}[$(date +%s)] F\n"
    else
    printf "${GREEN}[$(date +%s)] .\n"
    printf "${TXT_GREEN}[$(date +%s)] .\n"
    fi

    sleep 1
  2. manhdaovan revised this gist Oct 5, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion check_probe.sh
    Original file line number Diff line number Diff line change
    @@ -19,11 +19,12 @@ while true; do

    sleep 1
    done
    echo "[$(date +%s)] Finish checking probation for url: $url"

    # check until response success
    # echo "[$(date +%s)] Start checking probation for url: $url"
    # until $(curl --max-time 1 --output /dev/null --silent --fail $url); do
    # printf '.'
    # sleep 1
    # done
    # echo ""
    # echo "[$(date +%s)] Finish checking probation for url: $url"
  3. manhdaovan revised this gist Oct 5, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions check_probe.sh
    Original file line number Diff line number Diff line change
    @@ -21,6 +21,7 @@ while true; do
    done
    echo "[$(date +%s)] Finish checking probation for url: $url"

    # check until response success
    # until $(curl --max-time 1 --output /dev/null --silent --fail $url); do
    # printf '.'
    # done
  4. manhdaovan created this gist Oct 5, 2021.
    28 changes: 28 additions & 0 deletions check_probe.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    #!/bin/bash

    # Simple tool to check probation of given URL
    # using cURL with HTTP GET method.

    url=$1
    RED='\033[0;31m'
    GREEN='\033[0;32m'

    # check until pressing Ctr+C
    echo "[$(date +%s)] Start checking probation for url: $url"
    while true; do
    if ! curl --max-time 1 --output /dev/null --silent --fail $url &> /dev/null
    then
    printf "${RED}[$(date +%s)] F\n"
    else
    printf "${GREEN}[$(date +%s)] .\n"
    fi

    sleep 1
    done
    echo "[$(date +%s)] Finish checking probation for url: $url"

    # until $(curl --max-time 1 --output /dev/null --silent --fail $url); do
    # printf '.'
    # done
    # echo ""
    # echo "[$(date +%s)] Finish checking probation for url: $url"