Skip to content

Commit

Permalink
added ubstakker
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalraja committed Jul 15, 2022
1 parent 4840115 commit 5dade63
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 8 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
A simple http request checker to monitor if it's up or down. Scheduling is done through cron jobs.

```bash
# Install on unix/linux environment with
curl -s -S -L https://raw.githubusercontent.com/altlimit/statusalert/master/install.sh | bash

# Run against a valid *.http using VSCode REST Client
statusalert --http-file test.http
```
Expand Down
13 changes: 5 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ echo "Building..."
rm -rf ./build
GOOS=windows GOARCH=amd64 go build -o build/win/statusalert.exe
GOOS=linux GOARCH=amd64 go build -o build/linux/statusalert
GOOS=darwin GOARCH=amd64 go build -o build/osx/statusalert
cp -R site build/win/
cp -R site build/linux/
cp -R site build/osx/
GOOS=darwin GOARCH=amd64 go build -o build/darwin/statusalert
cd build/win
zip -rq ../win.zip . -x ".*"
cd ../linux
zip -rq ../linux.zip . -x ".*"
cd ../osx
zip -rq ../osx.zip . -x ".*"
tar -czf ../linux.tgz statusalert
cd ../darwin
tar -czf ../darwin.tgz statusalert
cd ..
rm -rf osx
rm -rf darwin
rm -rf linux
rm -rf win
echo "Done"
58 changes: 58 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

set -e

add_to_path() {
shell="$SHELL";
rcfile=".bashrc"
if [[ "$shell" == *"zsh" ]]; then
rcfile=".zshrc";
fi
if grep -q "/.altlimit/bin" "$HOME/$rcfile"; then
echo "~/.altlimit/bin already in zsh path"
else
echo "Adding ~/.altlimit/bin to PATH in $rcfile";
echo 'export PATH=$PATH:$HOME/.altlimit/bin' >> $HOME/$rcfile;
echo "Restart your terminal or run 'source ~/$rcfile'"
fi
}

install_binary() {
if [[ ! -d $HOME/.altlimit/bin ]]; then
echo "Making $HOME/.altlimit/bin"
mkdir -p $HOME/.altlimit/bin;
fi
echo "Downloading latest statusalert binary at: $1";
curl -o $HOME/.altlimit/bin/statusalert.tgz -s -S -L "$1"
tar -xf $HOME/.altlimit/bin/statusalert.tgz -C $HOME/.altlimit/bin/
rm $HOME/.altlimit/bin/statusalert.tgz
if [ $? -ne 0 ]; then
echo "Download failed.";
exit 1;
fi
chmod +x $HOME/.altlimit/bin/statusalert;
add_to_path;
echo "statusalert has been installed at $HOME/.altlimit/bin";
}

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
install_binary "https://github.com/altlimit/statusalert/releases/download/latest/linux.tgz"
else
echo "${MACHINE_TYPE} not supported. Try building from source.";
exit 1;
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
install_binary "https://github.com/altlimit/statusalert/releases/download/latest/darwin.tgz"
else
echo "${MACHINE_TYPE} not supported. Try building from source.";
exit 1;
fi
else
echo "$OSTYPE not yet supported.";
exit 1;
fi

0 comments on commit 5dade63

Please sign in to comment.