webbuild-cgi: display live server stats in first line of jobs window

This commit is contained in:
Silvan Calarco 2015-05-14 17:13:34 +02:00
parent 6e6d92d5a2
commit 90a0d85269

View File

@ -394,13 +394,15 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
PACKAGE_ENCODED=`cgi_encodevar $4`
[ $numprocess -eq 1 ] && {
# echo -n "<div align=left class=processes>"
echo -n "<b>Webbuild jobs:</b> "
u="$(uptime)"
f="$(df / -k -h --output=avail,pcent|tail -n1)"
b=`ps ax|grep rpmbuild|grep spec|while read l; do basename "${l/.spec}"; done`
echo -n "Load: <b>${u/*: }</b> | Disk: <b>$f</b> | Now building: <b>$b</b> | "
if [ "$STATE_JOBSSHOWALL" != "1" ]; then
echo "[ <a href=# onclick=ajax_getvalues(\"REQUEST=refreshjobs&JOBSSHOWALL=true\");>Show all</a> ]"
echo "My jobs: [<a href=# onclick=ajax_getvalues(\"REQUEST=refreshjobs&JOBSSHOWALL=true\");>Show all jobs</a>]"
else
echo "[ <a href=# onclick=ajax_getvalues(\"REQUEST=refreshjobs&JOBSSHOWALL=false\");>Show mine only</a> ]"
echo "All jobs: [<a href=# onclick=ajax_getvalues(\"REQUEST=refreshjobs&JOBSSHOWALL=false\");>Only show my jobs</a>]"
fi
echo -n "<i>(please click on [x] to clean your jobs when they are done)</i>"
echo -n "<br>"
}
[ "$STATE_JOBSSHOWALL" = "1" -o "$USER" = "$2" ] || continue