my love for the mystical and magical cURL

Categories: Linux, Script

begin snippet:

function port {
        if [ $? -ne 0 ] ; then
                printf "warning: "
                        if [ $? -eq 6 ]; then
                                echo "cant resolve host"
                if [ $? -eq 7 ]; then
                        echo "cant connect to host"
                printf "site may be down\n"
                printf "site is up\n"

curl -s ${1} | egrep 30[0-9] >/dev/null

so for the one or two of you that actually read this site, you may recognize that snippet from a few posts ago.
but i have learned to love cURL and errorlevels when used in conjunction. that function above (a crude one at that) has already saved my ass because of the errorlevel output.

it sounds lame, i know. but you are reading this site so it must have peaked your interest regardless of the lame factor.


    Leave a Reply

    Your email address will not be published. Required fields are marked *