#!/bin/sh #------------------------------------------------------------------------------ # /usr/local/htdocs/spaceinfo.cgi - space information # # Copyright (c) 2003-2010 Marcus Herleb, info(at)herleb(dot).de # Copyright (c) 2011-2024 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2003-10-11 mgh # Last Update: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version.. #------------------------------------------------------------------------------ # get kernel version KV=${KV="`cat /proc/sys/kernel/osrelease`"} echo "Content-Type: text/html; charset=iso-8859-1" echo "Cache-control: no-store" # HTTP/1.1 (or no-cache?) echo "Pragma: no-cache" # HTTP/1.0 echo "Expires: `date -Ru`" # Expires now! echo "Refresh: 30" echo echo "" echo "" echo "Space Info" echo "

Speicherplatz

" KV="`echo $KV|cut -b-3`" echo "" cat /proc/meminfo > meminfo.txt if [ -f meminfo.txt ] then swp="used" tdbg="red" if [ $KV = "2.4" ] # Kernel 2.4.x Routine then while read a b c d e f g do if [ $a = "Swap:" -a $b = "0" ] then swp="not installed" tdbg="yellow" else if [ $a = "Swap:" -a $a = "0" ] then swp="not used" tdbg="#e9e9e9" fi fi if [ $a = "MemFree:" ] then echo "" # echo $b > /../../tmp/mem.tmp fi done < meminfo.txt else # Kernel != 2.4 while read a b c do if [ $a = "SwapTotal:" -a $b = "0" ] then swp="not installed" tdbg="yellow" echo "" else if [ $a = "MemFree:" ] then echo "" # echo $b > /../../tmp/mem.tmp fi if [ $a = "SwapTotal:" -a $a = "0" ] then swp="not used" tdbg="#e9e9e9" fi fi done < meminfo.txt fi fi echo "
$b KB RAM freeSwap $swp
Swap $swp$b KB RAM free
" echo "" echo "" echo "" echo "" echo "" echo "
MOUNTPOINTBELEGTFREI
" dd=`df -h` i=7 mdevice=true while [ -n "$mdevice" ] do bga=#efefef bgb=cyan bgc=#00FF00 i=`expr $i + 1` mdevice=$(echo `df` | cut -d" " -f$i) if [ -n "$mdevice" ] # Abbruchbedingung then echo "" echo "" a=5 a=`expr $a + $i` echo "" # Mountpoint b=4 b=`expr $b + $i` belegt=$(echo $dd | cut -d" " -f$b | cut -d "%" -f1) c=1 c=`expr $c + $i` d=3 d=`expr $d + $i` if [ "$belegt" -le "19" ] then echo "" fi if [ "$belegt" -le "50" -a "$belegt" -ge "20" ] then echo "" fi if [ "$belegt" -le "69" -a "$belegt" -ge "51" ] then echo "" fi if [ "$belegt" -ge "70" -a "$belegt" -le "84" ] then bgb=#ccccff bgc=yellow echo "" fi if [ "$belegt" -ge "85" -a "$belegt" -le "100" ] then bgb=#ff6699 bgc=red echo "" fi i=`expr $i + 5` echo "
$(echo $dd | cut -d" " -f$a)$belegt % of  $(echo $dd | cut -d" " -f$c) $(echo $dd | cut -d" " -f$d)$belegt % of  $(echo $dd | cut -d" " -f$c) $(echo $dd | cut -d" " -f$d)$belegt % of  $(echo $dd | cut -d" " -f$c) $(echo $dd | cut -d" " -f$d)$belegt % of  $(echo $dd | cut -d" " -f$c)   $(echo $dd | cut -d" " -f$d)$belegt % of  $(echo $dd | cut -d" " -f$c)  $(echo $dd | cut -d" " -f$d)
" else echo "" fi done