Added twitch stream to status page
This commit is contained in:
parent
1d3ad7ad29
commit
982c28096e
21
status.sh
21
status.sh
|
@ -1,4 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
token="$1"
|
||||
running() {
|
||||
name=$1
|
||||
pgrep -f "$name"
|
||||
|
@ -31,6 +33,20 @@ check_app() {
|
|||
write '</td></tr>'
|
||||
}
|
||||
|
||||
check_twitch() {
|
||||
channel="$1"
|
||||
token="$2"
|
||||
write '<tr><td class="first">'
|
||||
write "<a href='https://twitch.tv/$channel'>My Twitch Stream</a>"
|
||||
write '</td><td class="second">'
|
||||
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 <<EOF
|
||||
<html><body>
|
||||
|
@ -83,6 +99,10 @@ footer {
|
|||
padding-bottom: 0.5em;
|
||||
padding-right: 0.9em;
|
||||
}
|
||||
a {
|
||||
color: #79c;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style></head>
|
||||
<div id='main'>
|
||||
<table id='tbl'>
|
||||
|
@ -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 '</table></div>'
|
||||
write "<footer>Last updated: $(date '+%d.%m.%y at %H:%M:%S')"
|
||||
write '</body></html>'
|
||||
|
|
Loading…
Reference in New Issue
Block a user