Added status script
This commit is contained in:
parent
18b1ba9c69
commit
7409657c1e
|
@ -0,0 +1,101 @@
|
|||
#!/bin/sh
|
||||
running() {
|
||||
name=$1
|
||||
pgrep -f "$name"
|
||||
[ $? -eq 0 ]
|
||||
}
|
||||
|
||||
write() {
|
||||
echo "$1" >> index.html
|
||||
}
|
||||
|
||||
echo_down() {
|
||||
write '<span class="down">down</span>'
|
||||
}
|
||||
|
||||
echo_up() {
|
||||
write '<span class="up">up</span>'
|
||||
}
|
||||
|
||||
check_app() {
|
||||
name="$1"
|
||||
process="$2"
|
||||
write '<tr><td class="first">'
|
||||
write "$name"
|
||||
write '</td><td class="second">'
|
||||
if running "$process"; then
|
||||
echo_up
|
||||
else
|
||||
echo_down
|
||||
fi
|
||||
write '</td></tr>'
|
||||
}
|
||||
|
||||
cd /usr/share/nginx/html/status
|
||||
base=`cat <<EOF
|
||||
<html><body>
|
||||
<head><style>
|
||||
body {
|
||||
background-color: #000;
|
||||
color: #ddd;
|
||||
font-family: "Hack", "Fira Code", "Lucida Console", monospace;
|
||||
font-size: 16pt;
|
||||
line-height: 140%;
|
||||
}
|
||||
#main {
|
||||
margin: 3em auto;
|
||||
width: 70%;
|
||||
text-align: center;
|
||||
}
|
||||
#tbl {
|
||||
width: 100%;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table td, table th {
|
||||
border-bottom: 1px solid #444;
|
||||
padding: 0.5em 1em;
|
||||
}
|
||||
table tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.up {
|
||||
color: green;
|
||||
}
|
||||
.down {
|
||||
color: red;
|
||||
}
|
||||
.first {
|
||||
width:80%;
|
||||
}
|
||||
.second {
|
||||
width:20%;
|
||||
}
|
||||
footer {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 20pt;
|
||||
color: #666;
|
||||
font-size: 8pt;
|
||||
padding-bottom: 0.5em;
|
||||
padding-right: 0.9em;
|
||||
}
|
||||
</style></head>
|
||||
<div id='main'>
|
||||
<table id='tbl'>
|
||||
EOF
|
||||
`
|
||||
echo "$base" > index.html
|
||||
check_app 'kageru.moe' 'manage.py runserver'
|
||||
check_app 'kaleido.kageru.moe' 'kaleidowebsite'
|
||||
check_app 'ts.kageru.moe' 'ts3server_startscript.sh start'
|
||||
check_app 'git.kageru.moe' '\.\/gitea'
|
||||
check_app 'Selphybot (discord)' 'selphybot'
|
||||
check_app 'Colorbot (discord)' '\.\/colorbot'
|
||||
check_app 'Gmod server' 'gmod\/runserver.sh'
|
||||
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