PXE bash-cgi index.sh
  1. #!/bin/sh
  2. cat << EOF
  3. Content-Type: text/html
  4.  
  5. <html>
  6. <head>
  7. <title>PXE server @ VirtualBox</title>
  8. <link rel="shortcut icon" href="data:image/x-ico;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAPbSURBVHjaYpwx4zgDDuDEzsZix8jIwMAIhMjgPxCzszFb/f33Tx8ggFhevHgFFmRiYmT4+/cvAyNIB1ADkO8ooyRQ8/v/T4Zf//4w/AfKM/39B9XOwPCPkYPhw9tfnwACiJGNjQsswM/Pz8DCwsLw8eNHhj9//jD8/fVfpmSWw1VNbW2+C3cfMgh++crwQU6YgYmFmYGNlZXh9qdLDBtrL20GCCCWX7++gQ348YOJQUREhOHtm+8Mv37/ZhA1Y3tvJPrtv7OBBAOrwEcGxVcsDN8tTRl+sn5l+M70iEHolQTDmv8nPwIEEAvMX0xMzAz//v0HawYClq/v/jCz8vD8f/X9NcMN/v8Mr6UlGX6/P83Ayy/GYLnvOcMLLqDXWRmYAAIIbsC/f/9AXjCzsLDI+Pnzp9aTRy+/7V93n0tZ05BB5KUiw4/LHxk+a3xk+Mr5l4H7wx8GJgawRQwAAQQ3QFBQMLCmpmahs7Mz7759BxgePHzI8O7ZS4aqmr0MQk6CDLLvNBg41QQZ3n18znBWX57h03dg2P05wwAQQExQ/ZIGBgYz/Pz8eGVlZRl+/frLEBwSwjBxxmSGn0/4GHbtOM/A7cfA8PXPN4bvP34xnDnFzPD6rBQDOysLA0AAwVwQ+OHDe7F9+44wODkrMNiadDCI/49gOLDfm+HyxfPAkJdl+PeDjeHTv68MPKyCDJfEtzB8/vKd4e+ffwwAAQRygQgQx1++fIXh+/cvDDy8SgwaauEMvOLWDCJiogwSUtIMXz/eYrh/4AFQoQID/3dphp9SnxjeiL0FhxtAADEDNa8GYgczMzOGnp5uBlYWDoZvfxwZ3v8UB6U2BmVlNYYDB/YyvDz9noGfW4hB5L4yg5qaJsObn68Z7m95dxkggEAumADE22NiohmYmZkZPn/+xvD+/RuGD+/eMDx//opBVESaQdvIgMHATo/hPx8jw/pLqxkefXjCoMFpyPAfmDABAggUBruB+I24uKwdMAlwv3v/jeHL508Mnz59Bxr2k+Hzux8M0s7yDKauWgz3vt5kYJNnYvjM8ZmB6w8fOFUDBBAzCws43b9iYPymY2Uto/P541eGL18YgJq/MDD+f8Jw5tYmhkNsBxjOMVxmePj5EQMrKxPDz/+/Ga6+u8Tw6sDnGwABxFhfzwQSzIoOk5+qIPKb4eelTwwbL8UzaDk/Z9BRucvw+95lhhUrfzHErQGawMzwBpo1GYFsRoYHDIcBAohRRRnIY2JQ09dgrBJh+S/95D7D731XGc4pqzMwmGsyGDB8ZmA/d4nh3flnDEuBLj4BzY6MUPwPIMAA9ORio5qu/OAAAAAASUVORK5CYII=" type="image/x-icon">
  9. <meta http-equiv="refresh" content="300">
  10. </head>
  11. <body text="#384239" bgcolor="#FFFFFF" link="#384239" vlink="#384239" alink="#384239">
  12. EOF
  13.  
  14.  
  15. echo "<h1>PXE server @ VirtualBox:</h1>"
  16. echo "<pre>"
  17. #echo '<a style="text-decoration: none;" href="/install">Otevrit adresar /install</a><br><br>'
  18.  
  19. #uptime
  20. uptime=$(</proc/uptime)
  21. uptime=${uptime%%.*}
  22. seconds=$(( uptime%60 ))
  23. minutes=$(( uptime/60%60 ))
  24. hours=$(( uptime/60/60%24 ))
  25. days=$(( uptime/60/60/24 ))
  26. echo "<strong>PXE server je zapnut:</strong>" '<font color="#585858" style="font-weight: bold; font-variant: small-caps;">' $(echo $days dnu $hours hodin $minutes minut $seconds sekund) "</font> <br><br>"
  27.  
  28. #zdravi
  29. #sensors |grep -i "fan1\|cpu\|m/b" |sed 's/(div = 2)//g' > /tmp/health.tmp
  30. #echo "Health status:" '<br><font color="#585858" style="font-weight: bold; font-variant: small-caps;">' $(cat -E /tmp/health.tmp |sed 's/\$/<br>/g'; rm /tmp/health.tmp) '</font><br>'
  31.  
  32.  
  33. #disk
  34. echo "Volne misto na disku:" '<br><font color="#585858" style="font-weight: bold; font-variant: small-caps;">' $(df -h |grep UUID |awk '{print $4" z celkovych "$2}') '</font><br>'
  35.  
  36. #ram
  37. MEM=$(cat /proc/meminfo |grep Mem)
  38. echo "Vyuziti pameti RAM:" '<br><font color="#585858" style="font-weight: bold; font-variant: small-caps;">' $(echo $MEM |awk '{print $5" "$6" z celkovych "$2" "$3}') '</font><br>'
  39.  
  40. #distra
  41. tree /var/lib/tftpboot |sed 's/ /\&nbsp\;/g' > /tmp/tree.tmp
  42. echo "Vypis TFTP adresare s distry:<br><pre><font color="#585858">" $(cat -E /tmp/tree.tmp |sed 's/\$/<br>/g'; rm /tmp/tree.tmp) "</font></pre><br>"
  43.  
  44. #prihlaseni uzivatele
  45. echo "<strong>Aktualne prihlaseni uzivatele:</strong>" $(who |sed 's/10.0.0/foo.bar/g' > /tmp/usrs.tmp) '<pre><font color="red">' $(cat -E /tmp/usrs.tmp |sed 's/\$/<br>/g'; rm /tmp/usrs.tmp) "</font></pre><br>"
  46. cat << EOF
  47. </pre>
  48. </body>
  49. </html>
  50. EOF
Parsed in 0.035 seconds