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
|
#!/bin/sh
|
||||||
|
|
||||||
|
token="$1"
|
||||||
running() {
|
running() {
|
||||||
name=$1
|
name=$1
|
||||||
pgrep -f "$name"
|
pgrep -f "$name"
|
||||||
|
@ -31,6 +33,20 @@ check_app() {
|
||||||
write '</td></tr>'
|
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
|
cd /usr/share/nginx/html/status
|
||||||
base=`cat <<EOF
|
base=`cat <<EOF
|
||||||
<html><body>
|
<html><body>
|
||||||
|
@ -83,6 +99,10 @@ footer {
|
||||||
padding-bottom: 0.5em;
|
padding-bottom: 0.5em;
|
||||||
padding-right: 0.9em;
|
padding-right: 0.9em;
|
||||||
}
|
}
|
||||||
|
a {
|
||||||
|
color: #79c;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
</style></head>
|
</style></head>
|
||||||
<div id='main'>
|
<div id='main'>
|
||||||
<table id='tbl'>
|
<table id='tbl'>
|
||||||
|
@ -96,6 +116,7 @@ check_app 'git.kageru.moe' '\.\/gitea'
|
||||||
check_app 'Selphybot (discord)' 'selphybot'
|
check_app 'Selphybot (discord)' 'selphybot'
|
||||||
check_app 'Colorbot (discord)' '\.\/colorbot'
|
check_app 'Colorbot (discord)' '\.\/colorbot'
|
||||||
check_app 'Gmod server' 'gmod\/runserver.sh'
|
check_app 'Gmod server' 'gmod\/runserver.sh'
|
||||||
|
check_twitch 'kageru_' "$token"
|
||||||
write '</table></div>'
|
write '</table></div>'
|
||||||
write "<footer>Last updated: $(date '+%d.%m.%y at %H:%M:%S')"
|
write "<footer>Last updated: $(date '+%d.%m.%y at %H:%M:%S')"
|
||||||
write '</body></html>'
|
write '</body></html>'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user