add option for past incidents at the bottom of the page
This commit is contained in:
parent
74d31c0f73
commit
d458e344ef
26
tinystatus
26
tinystatus
|
@ -7,10 +7,12 @@ HEADER="Global Status"
|
|||
HTMLDIR="/var/www/htdocs/default"
|
||||
HTMLFILE="index.html"
|
||||
INCIDENTSFILE="incidents.txt"
|
||||
PASTINCIDENTSFILE="pastincidents.txt"
|
||||
PUSHOVER="/home/mischa/bin/pushover.pl"
|
||||
PUSHOVER_CONF="/home/mischa/_pushover.conf"
|
||||
PUSHOVER_STATUS="status"
|
||||
RECIPIENT="alerts@high5.nl"
|
||||
REFRESH=60
|
||||
SENDER="tinystatus@high5.nl"
|
||||
TIMEOUT=10
|
||||
TITLE="Tiny Status"
|
||||
|
@ -18,7 +20,7 @@ USERAGENT="User-Agent: Mozilla/5.0 (OpenBSD; Intel OpenBSD 7.4; rv:109.0) Gecko/
|
|||
WORKDIR=/home/mischa/tinystatus
|
||||
|
||||
usage() {
|
||||
echo "usage: ${0##*/} [-c checksfile] [-i incidentsfile] [-o htmlfile]" 1>&2
|
||||
echo "usage: ${0##*/} [-c checksfile] [-i incidentsfile] [-p pastincidentsfile] [-o htmlfile]" 1>&2
|
||||
exit
|
||||
}
|
||||
|
||||
|
@ -94,6 +96,7 @@ while getopts c:i:o:h arg; do
|
|||
case ${arg} in
|
||||
c) CHECKFILE=${OPTARG};;
|
||||
i) INCIDENTSFILE=${OPTARG};;
|
||||
p) PASTINCIDENTSFILE=${OPTARG};;
|
||||
o) HTMLFILE=${OPTARG};;
|
||||
h) usage;;
|
||||
*) usage;;
|
||||
|
@ -120,7 +123,14 @@ done < "${CHECKFILE}"
|
|||
wait
|
||||
|
||||
cat << EOF >> ${_htmlfile}
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>${TITLE}</title><style>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="refresh" content="${REFRESH}">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>${TITLE}</title>
|
||||
<style>
|
||||
body { font-family: segoe ui,Roboto,Oxygen-Sans,Ubuntu,Cantarell,helvetica neue,Verdana,sans-serif; }
|
||||
h1 { margin-top: 30px; }
|
||||
ul { padding: 0px; }
|
||||
|
@ -135,7 +145,8 @@ li { list-style: none; margin-bottom: 2px; padding: 5px; border-bottom: 1px soli
|
|||
.maint { color: #5DADE2; }
|
||||
.small { font-size: 80%; }
|
||||
.status { float: right; }
|
||||
</style></head>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='container'>
|
||||
<h1>${HEADER}</h1>
|
||||
|
@ -189,8 +200,15 @@ done
|
|||
cat << EOF >> ${_htmlfile}
|
||||
</ul>
|
||||
<p class=small> Last check: $(date +%FT%T%z) <a href="https://git.high5.nl/tinystatus/">Tinystatus</a> loosely based on <a href="https://github.com/bderenzo/tinystatus">Tinystatus</a></p>
|
||||
EOF
|
||||
if [ -s "${PASTINCIDENTSFILE}" ]; then
|
||||
echo '<h1>Past Incidents</h1>' >> ${_htmlfile}
|
||||
sed 's|^\(.*\)$|<p>\1</p>|' "${PASTINCIDENTSFILE}" >> ${_htmlfile}
|
||||
fi
|
||||
cat << EOF >> ${_htmlfile}
|
||||
</div>
|
||||
</body></html>
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
|
||||
cp ${_htmlfile} ${HTMLDIR}/${HTMLFILE}
|
||||
|
|
Loading…
Reference in New Issue