Skip to content

Commit 5dade63

Browse files
committed
added ubstakker
1 parent 4840115 commit 5dade63

File tree

3 files changed

+66
-8
lines changed

3 files changed

+66
-8
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
A simple http request checker to monitor if it's up or down. Scheduling is done through cron jobs.
44

55
```bash
6+
# Install on unix/linux environment with
7+
curl -s -S -L https://raw.githubusercontent.com/altlimit/statusalert/master/install.sh | bash
8+
69
# Run against a valid *.http using VSCode REST Client
710
statusalert --http-file test.http
811
```

build.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@ echo "Building..."
44
rm -rf ./build
55
GOOS=windows GOARCH=amd64 go build -o build/win/statusalert.exe
66
GOOS=linux GOARCH=amd64 go build -o build/linux/statusalert
7-
GOOS=darwin GOARCH=amd64 go build -o build/osx/statusalert
8-
cp -R site build/win/
9-
cp -R site build/linux/
10-
cp -R site build/osx/
7+
GOOS=darwin GOARCH=amd64 go build -o build/darwin/statusalert
118
cd build/win
129
zip -rq ../win.zip . -x ".*"
1310
cd ../linux
14-
zip -rq ../linux.zip . -x ".*"
15-
cd ../osx
16-
zip -rq ../osx.zip . -x ".*"
11+
tar -czf ../linux.tgz statusalert
12+
cd ../darwin
13+
tar -czf ../darwin.tgz statusalert
1714
cd ..
18-
rm -rf osx
15+
rm -rf darwin
1916
rm -rf linux
2017
rm -rf win
2118
echo "Done"

install.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
add_to_path() {
6+
shell="$SHELL";
7+
rcfile=".bashrc"
8+
if [[ "$shell" == *"zsh" ]]; then
9+
rcfile=".zshrc";
10+
fi
11+
if grep -q "/.altlimit/bin" "$HOME/$rcfile"; then
12+
echo "~/.altlimit/bin already in zsh path"
13+
else
14+
echo "Adding ~/.altlimit/bin to PATH in $rcfile";
15+
echo 'export PATH=$PATH:$HOME/.altlimit/bin' >> $HOME/$rcfile;
16+
echo "Restart your terminal or run 'source ~/$rcfile'"
17+
fi
18+
}
19+
20+
install_binary() {
21+
if [[ ! -d $HOME/.altlimit/bin ]]; then
22+
echo "Making $HOME/.altlimit/bin"
23+
mkdir -p $HOME/.altlimit/bin;
24+
fi
25+
echo "Downloading latest statusalert binary at: $1";
26+
curl -o $HOME/.altlimit/bin/statusalert.tgz -s -S -L "$1"
27+
tar -xf $HOME/.altlimit/bin/statusalert.tgz -C $HOME/.altlimit/bin/
28+
rm $HOME/.altlimit/bin/statusalert.tgz
29+
if [ $? -ne 0 ]; then
30+
echo "Download failed.";
31+
exit 1;
32+
fi
33+
chmod +x $HOME/.altlimit/bin/statusalert;
34+
add_to_path;
35+
echo "statusalert has been installed at $HOME/.altlimit/bin";
36+
}
37+
38+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
39+
MACHINE_TYPE=`uname -m`
40+
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
41+
install_binary "https://github.com/altlimit/statusalert/releases/download/latest/linux.tgz"
42+
else
43+
echo "${MACHINE_TYPE} not supported. Try building from source.";
44+
exit 1;
45+
fi
46+
elif [[ "$OSTYPE" == "darwin"* ]]; then
47+
# Mac OSX
48+
MACHINE_TYPE=`uname -m`
49+
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
50+
install_binary "https://github.com/altlimit/statusalert/releases/download/latest/darwin.tgz"
51+
else
52+
echo "${MACHINE_TYPE} not supported. Try building from source.";
53+
exit 1;
54+
fi
55+
else
56+
echo "$OSTYPE not yet supported.";
57+
exit 1;
58+
fi

0 commit comments

Comments
 (0)