diff --git a/status.sh b/status.sh index 4fac83c..3e6ba52 100755 --- a/status.sh +++ b/status.sh @@ -1,4 +1,6 @@ #!/bin/sh + +token="$1" running() { name=$1 pgrep -f "$name" @@ -31,6 +33,20 @@ check_app() { write '' } +check_twitch() { + channel="$1" + token="$2" + write '' + write "My Twitch Stream" + write '' + curl https://api.twitch.tv/kraken/streams/$channel -H "Client-ID: $token" -s | grep '"stream_type":"live"' + if [ $? -eq 0 ]; then + echo_up + else + echo_down + fi +} + cd /usr/share/nginx/html/status base=`cat < @@ -83,6 +99,10 @@ footer { padding-bottom: 0.5em; padding-right: 0.9em; } +a { + color: #79c; + text-decoration: none; +}
@@ -96,6 +116,7 @@ check_app 'git.kageru.moe' '\.\/gitea' check_app 'Selphybot (discord)' 'selphybot' check_app 'Colorbot (discord)' '\.\/colorbot' check_app 'Gmod server' 'gmod\/runserver.sh' +check_twitch 'kageru_' "$token" write '
' write "