Anyway to improve this given shell script which keeps testing a website using curl command?Can't understand...

Car as a good investment

How to increment the value of a (decimal) variable (with leading zero) by +1?

How should I understand FPGA architecture?

Uniform Roe algebra of virtually abelian group is type I C*-algebra?

Idiom for a situation or event that makes one poor or even poorer?

How do I get my boyfriend to remove pictures of his ex girlfriend hanging in his apartment?

Does cover affect melee attacks?

Company indirectly discriminating against introverts, specifically INTJ

How does Golos work with cards that increase mana costs?

Where does the upgrade to macOS Catalina move root "/" directory files?

How to treat unhandled exceptions? (Terminate the application vs. Keep it alive)

Is it safe to pay bills over satellite internet?

Proving the order of quaternion group is 8

Advisor asked for my entire slide presentation so she could give the presentation at an international conference

Did I Traumatize My Puppy?

Moonlight bright enough to see by

I run daily 5kms but I cant seem to improve stamina when playing soccer

How do I copy an installed steam game on my PC to an external hard drive?

Why do Computer Science degrees contain a high proportion of mathematics?

I am often given, occasionally stolen, rarely sold, and never borrowed

If I did not sign promotion bonus document, my career would be over. Is this duress?

How do I count the number of elements in a list which are between two determined values?

How safe is the 4% rule if the U.S. goes back to the world mean?

Why are second inversion triads considered less consonant than first inversion triads?



Anyway to improve this given shell script which keeps testing a website using curl command?


Can't understand this script. bash <<(curl -s http://xxx.com)Testing using shell scriptsShell script using function () not finding commandFind files using shell scriptWarn in crontab if command has failed multiple consecutive timesShell Script to retrieve text from websitehow to put variable in CURL header using shell script?bash how to improve this scriptTrying to write a shell script that keeps testing a server remotely, but it keeps falling in else statement when I logoutNeed Improvement on Script Which Continuously Tests Website






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}








-1

















Here's the script which keeps testing given website and email via Mutt when it fails, using curl command, once it reduces failing emails from the version which uses ping command instead.



Would there be any way to improve it?



As follows:



#!/bin/bash
while true; do
date > /tmp/sdown.txt
if curl -fI "given.website.com" 1>& /dev/null ;
then
sleep 1
:
else
mutt -s "Website Down!!!" user@email.com < /tmp/sdown.txt
sleep 10
fi
done










share|improve this question























  • 1





    Improve in what way? Speed? Readability? Reliability?

    – Jeff Schaller
    1 hour ago











  • Might be reliability?

    – Vasconcelos1914
    1 hour ago


















-1

















Here's the script which keeps testing given website and email via Mutt when it fails, using curl command, once it reduces failing emails from the version which uses ping command instead.



Would there be any way to improve it?



As follows:



#!/bin/bash
while true; do
date > /tmp/sdown.txt
if curl -fI "given.website.com" 1>& /dev/null ;
then
sleep 1
:
else
mutt -s "Website Down!!!" user@email.com < /tmp/sdown.txt
sleep 10
fi
done










share|improve this question























  • 1





    Improve in what way? Speed? Readability? Reliability?

    – Jeff Schaller
    1 hour ago











  • Might be reliability?

    – Vasconcelos1914
    1 hour ago














-1












-1








-1








Here's the script which keeps testing given website and email via Mutt when it fails, using curl command, once it reduces failing emails from the version which uses ping command instead.



Would there be any way to improve it?



As follows:



#!/bin/bash
while true; do
date > /tmp/sdown.txt
if curl -fI "given.website.com" 1>& /dev/null ;
then
sleep 1
:
else
mutt -s "Website Down!!!" user@email.com < /tmp/sdown.txt
sleep 10
fi
done










share|improve this question















Here's the script which keeps testing given website and email via Mutt when it fails, using curl command, once it reduces failing emails from the version which uses ping command instead.



Would there be any way to improve it?



As follows:



#!/bin/bash
while true; do
date > /tmp/sdown.txt
if curl -fI "given.website.com" 1>& /dev/null ;
then
sleep 1
:
else
mutt -s "Website Down!!!" user@email.com < /tmp/sdown.txt
sleep 10
fi
done







bash shell-script shell scripting bourne-shell






share|improve this question














share|improve this question











share|improve this question




share|improve this question










asked 1 hour ago









Vasconcelos1914Vasconcelos1914

2702 silver badges15 bronze badges




2702 silver badges15 bronze badges











  • 1





    Improve in what way? Speed? Readability? Reliability?

    – Jeff Schaller
    1 hour ago











  • Might be reliability?

    – Vasconcelos1914
    1 hour ago














  • 1





    Improve in what way? Speed? Readability? Reliability?

    – Jeff Schaller
    1 hour ago











  • Might be reliability?

    – Vasconcelos1914
    1 hour ago








1




1





Improve in what way? Speed? Readability? Reliability?

– Jeff Schaller
1 hour ago





Improve in what way? Speed? Readability? Reliability?

– Jeff Schaller
1 hour ago













Might be reliability?

– Vasconcelos1914
1 hour ago





Might be reliability?

– Vasconcelos1914
1 hour ago










0






active

oldest

votes













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});















draft saved

draft discarded
















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f546024%2fanyway-to-improve-this-given-shell-script-which-keeps-testing-a-website-using-cu%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown


























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

















draft saved

draft discarded



















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f546024%2fanyway-to-improve-this-given-shell-script-which-keeps-testing-a-website-using-cu%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown









Popular posts from this blog

Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...