Simple bash website monitoring script

Moved Tips
  • Not everyone can afford expensive operational monitoring tools, so here’s a cheap and dirty way to use cURL to scrape a webpage, return it’s status, and then compare it with the value you’d get if the page was up. If that doesn’t match, we assume the page is down, and then trigger an email as an alarm.

    # Your site URL goes here
    result=$(curl -m 60 -Is $website | head -n 1 | tr -d "\r")
    # note that this value varies depending on platform. You should echo $result to see what the correct value is when querying the site itself when you know it's running.
    expecting="HTTP/2 200"; 
    if [ "$result" = "$expecting" ];
        output="$timestamp -> $website $result -> Website UP";
        echo $output;
        echo $output >> /path/to/your/logfile/log.txt 
        output="$timestamp -> $website $result -> Website DOWN";
        echo $output;
        echo $output >> /path/to/your/logfile/log.txt 
        # Fire an alert as the result isn't what we expected
        echo "From:" > /tmp/mail.tmp
        echo "To:" >> /tmp/mail.tmp
        echo "Subject: ALERT: Website $website is DOWN" >> /tmp/mail.tmp
        echo "" >> /tmp/mail.tmp
        echo $mailbody >> /tmp/mail.tmp
        cat /tmp/mail.tmp | /usr/sbin/sendmail -t -f ""

    This is very primitive, but works very well. Note, that sendmail is being used here to trigger an email. If you do not have that, you’ll need to substitute the path and command for whatever you want to use.

    Have fun…

  • @phenomlab this is useful 👍 thanks

  • 4 Votes
    12 Posts

    @Hari Yes, that’s one (of many) I would recommend. It’s going to be easier to do this under Windows and the fact that you are already connected using SMB is a huge plus.

  • 1 Votes
    1 Posts

    I got hit with this today. As I have a Pro subscription to Font Awesome, this allows me to use a much wider range of fonts. Unfortunately, NodeBB only seems to list the free fonts, so in order to use the Pro icons, you have to manually type the font name you want (leave the fa- part off, as it’s not needed).

    No issues, so I went ahead and typed in the name. Below is the result


    Now, despite the icon not showing here, it does once you save and reload the site. Great - problem solved then?

    Yes - until you want to change the icon back…

    Highlight over an unchanged icon, and you’ll see the mouse pointer change meaning there is a link behind it


    However, hover over one you’ve changed by typing in the value manually, and you’ll see the link is gone


    Panic stations… headless chicken… major cussing session… No - there is a way out

    Fire up the dev tools (F12 for console), and press the select tool. Now select the element with the missing link


    In the resultant element list, follow the HTML until you reach


    change-icon-link hidden

    Now delete the hidden part, so you are left with just change-icon-link and press enter

    You’ll see that the alt text appears for the image, which is enough for you to be able to click the anchor, and change the icon



    There you go. Now enjoy how smug you feel that you’ve sorted this problem yourself 🙂

  • 3 Votes
    6 Posts

    Seems like Google is finally crawling this site. And, “crawling” in the sense that it’s still extremely slow …

  • 3 Votes
    5 Posts

    @DownPW Same here.

  • 2 Votes
    2 Posts

    As an aside to this, there is also the command of tasklist which will provide a list of processes running on your machine, or a remote machine you are looking to query.


    There is also a useful list of switches below, plus the ability to format into a table, or CSV.

  • 2 Votes
    3 Posts

    @DownPW odd indeed. Looks like it’s spawning, immediately dying, then spawning again.

  • 6 Votes
    7 Posts

    @crazycells yes, this is something I see on a daily basis and despite how shockingly simple it is to conduct SIM jacking, it seems that several of the USA based banks are reluctant to switch to at least TOTP in the same sense as the USA has been extremely slow to adopt chip and pin - something Europe has been making use of for years.

    And they wonder why cheque and wire fraud is rife in America.

  • Invalid CSRF on dev install

    Moved Solved Tips
    5 Votes
    6 Posts

    @小城风雨多 Looking at the above, it seems you are missing the command to use nodebb for example. Otherwise, you are running the command against the admin database 🙂 Made that mistake myself before…