isitup icon indicating copy to clipboard operation
isitup copied to clipboard

Feature request: Script should return an error code when the page is down

Open rluetzner opened this issue 3 years ago • 2 comments

I stumbled upon this coming from https://github.com/sindresorhus/is-up-cli which inspired this project.

The nice thing about is-up-cli is that it returns a specific error code when the site is down and can therefore be used in automated scripts.

My use case is the following: I want to check if my self-hosted website is reachable from the internet and otherwise restart the Raspberry Pi where it's hosted. I'm struggling with a few network issues -- which I don't quite understand right now -- that go away when I reboot the Pi.

A simple way to test this is to run the following code in a Shell:

# Do something in case the page is up.
isitup nope.it.isnt && echo "Hell yeah! Everything's fine"

# Do something in case the page is down.
isitup nope.it.isnt || echo "Site is down"

I'd rather like to use this tool as it is written in Python which I understand and have the environment for on every machine. For is-up-cli I would need to install node.js and npm.

rluetzner avatar Feb 10 '22 13:02 rluetzner

I can also implement this myself and send you a pull request.

rluetzner avatar Feb 10 '22 13:02 rluetzner

Sounds good, I'll take a look at the pr in the weekend and ping you back later.

lord63 avatar Feb 22 '22 14:02 lord63