slitaz-forge rev 100

chub use PHP for stats
author Christophe Lincoln <pankso@slitaz.org>
date Thu Mar 08 23:25:54 2012 +0100 (2012-03-08)
parents 76b07c8fea53
children f7f74b531def
files chub/chub chub/web/index.html chub/web/index.php
line diff
     1.1 --- a/chub/chub	Thu Mar 08 16:47:31 2012 +0100
     1.2 +++ b/chub/chub	Thu Mar 08 23:25:54 2012 +0100
     1.3 @@ -35,6 +35,7 @@
     1.4  		cd $REPOS/slitaz-forge
     1.5  		#hg update when repos will be on Chub
     1.6  		hg pull -u
     1.7 +		rm -rf $VHOST/*.*
     1.8  		cp -a chub/web/* $VHOST ;;
     1.9  	stats)
    1.10  		# Echo some stats.
     2.1 --- a/chub/web/index.html	Thu Mar 08 16:47:31 2012 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,82 +0,0 @@
     2.4 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     2.5 -    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2.6 -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
     2.7 -<head>
     2.8 -	<title>SliTaz Chub</title>
     2.9 -	<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
    2.10 -	<meta name="description" content="slitaz chub server at COSI" />
    2.11 -	<meta name="robots" content="index, nofollow" />
    2.12 -	<meta name="author" content="SliTaz Contributors" />
    2.13 -	<link rel="shortcut icon" href="favicon.ico" />
    2.14 -	<link rel="stylesheet" type="text/css" href="slitaz.css" />
    2.15 -</head>
    2.16 -<body>
    2.17 -
    2.18 -<!-- Header -->
    2.19 -<div id="header">
    2.20 -	<div id="logo"></div>
    2.21 -	<div id="network">
    2.22 -		<a href="http://www.slitaz.org/">
    2.23 -			<img src="images/network.png" alt="network.png" /></a>
    2.24 -		<a href="http://scn.slitaz.org/">Community</a>
    2.25 -		<a href="http://doc.slitaz.org/">Doc</a>
    2.26 -		<a href="http://forum.slitaz.org/">Forum</a>
    2.27 -		<a href="http://bugs.slitaz.org">Bugs</a>
    2.28 -		<a href="http://hg.slitaz.org/">Hg</a>
    2.29 -	</div>
    2.30 -	<h1><a href="http://www.slitaz.org/">SliTaz Chub</a></h1>
    2.31 -</div>
    2.32 -
    2.33 -<!-- Block -->
    2.34 -<div id="block">
    2.35 -	<!-- Navigation -->
    2.36 -	<div id="block_nav">
    2.37 -		<h4>Servers</h4>
    2.38 -		<ul>
    2.39 -			<li><a href="http://tank.slitaz.org/">Tank Server</a></li>
    2.40 -			<li><a href="http://mirror.slitaz.org/">Mirror Server</a></li>
    2.41 -		</ul>
    2.42 -	</div>
    2.43 -	<!-- Information/image -->
    2.44 -	<div id="block_info">
    2.45 -		<h4>Codename: chub</h4>
    2.46 -		<p>
    2.47 -			This is the SliTaz GNU/Linux Community HUB server. This
    2.48 -			virtual machine is gracefuly host by COSI at Clarkson
    2.49 -			University <a href="http://cosi.clarkson.edu/">cosi.clarkson.edu</a>
    2.50 -		</p>
    2.51 -	</div>
    2.52 -</div>
    2.53 -
    2.54 -<!-- Content -->
    2.55 -<div id="content">
    2.56 -
    2.57 -<p>
    2.58 -	Under construction :-)
    2.59 -</p>
    2.60 -
    2.61 -<!-- End of content -->
    2.62 -</div>
    2.63 -
    2.64 -<!-- Footer -->
    2.65 -<div id="footer">
    2.66 -	Copyright &copy; <span class="year"></span>
    2.67 -	<a href="http://www.slitaz.org/">SliTaz</a> - Network:
    2.68 -	<a href="http://scn.slitaz.org/">Community</a>
    2.69 -	<a href="http://doc.slitaz.org/">Doc</a>
    2.70 -	<a href="http://forum.slitaz.org/">Forum</a>
    2.71 -	<a href="http://pkgs.slitaz.org/">Packages</a>
    2.72 -	<a href="http://bugs.slitaz.org">Bugs</a>
    2.73 -	<a href="http://hg.slitaz.org/">Hg</a>
    2.74 -	<p>
    2.75 -		SliTaz @
    2.76 -		<a href="http://twitter.com/slitaz">Twitter</a>
    2.77 -		<a href="http://www.facebook.com/slitaz">Facebook</a>
    2.78 -		<a href="http://distrowatch.com/slitaz">Distrowatch</a>
    2.79 -		<a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a>
    2.80 -		<a href="http://flattr.com/profile/slitaz">Flattr</a>
    2.81 -	</p>
    2.82 -</div>
    2.83 -
    2.84 -</body>
    2.85 -</html>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/chub/web/index.php	Thu Mar 08 23:25:54 2012 +0100
     3.3 @@ -0,0 +1,112 @@
     3.4 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     3.5 +    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     3.6 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
     3.7 +<head>
     3.8 +	<title>SliTaz Chub</title>
     3.9 +	<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
    3.10 +	<meta name="description" content="slitaz chub server at COSI" />
    3.11 +	<meta name="robots" content="index, nofollow" />
    3.12 +	<meta name="author" content="SliTaz Contributors" />
    3.13 +	<link rel="shortcut icon" href="favicon.ico" />
    3.14 +	<link rel="stylesheet" type="text/css" href="slitaz.css" />
    3.15 +</head>
    3.16 +<body>
    3.17 +
    3.18 +<!-- Header -->
    3.19 +<div id="header">
    3.20 +	<div id="logo"></div>
    3.21 +	<div id="network">
    3.22 +		<a href="http://www.slitaz.org/">
    3.23 +			<img src="images/network.png" alt="network.png" /></a>
    3.24 +		<a href="http://scn.slitaz.org/">Community</a>
    3.25 +		<a href="http://doc.slitaz.org/">Doc</a>
    3.26 +		<a href="http://forum.slitaz.org/">Forum</a>
    3.27 +		<a href="http://bugs.slitaz.org">Bugs</a>
    3.28 +		<a href="http://hg.slitaz.org/">Hg</a>
    3.29 +	</div>
    3.30 +	<h1><a href="http://www.slitaz.org/">SliTaz Tank</a></h1>
    3.31 +</div>
    3.32 +
    3.33 +<!-- Block -->
    3.34 +<div id="block">
    3.35 +	<!-- Navigation -->
    3.36 +	<div id="block_nav">
    3.37 +		<h4>Project servers</h4>
    3.38 +		<ul>
    3.39 +			<li><a href="http://tank.slitaz.org/">Tank</a></li>
    3.40 +			<li><a href="http://mirror.slitaz.org/">Mirror</a></li>
    3.41 +		</ul>
    3.42 +	</div>
    3.43 +	<!-- Information/image -->
    3.44 +	<div id="block_info">
    3.45 +		<h4>Codename: chub</h4>
    3.46 +		<p>
    3.47 +			This is the SliTaz GNU/Linux Community HUB server. This
    3.48 +			virtual machine is gracefuly host by COSI at Clarkson
    3.49 +			University <a href="http://cosi.clarkson.edu/">cosi.clarkson.edu</a>
    3.50 +		</p>
    3.51 +		<p>
    3.52 +			Tank CPU is a <?php system("sed -e '/^model name/!d;s/.*Intel(R) //;" .         
    3.53 +			"s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //' </proc/cpuinfo |" .
    3.54 +			" awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
    3.55 +			"if (n == 4) printf \"quad \"; print s }' ")?> -
    3.56 +			<?php system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
    3.57 +			"n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ".
    3.58 +			"printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?>
    3.59 +		</p>
    3.60 +	</div>
    3.61 +</div>
    3.62 +
    3.63 +<!-- Content -->
    3.64 +<div id="content">
    3.65 +
    3.66 +<h2>System stats</h2>
    3.67 +
    3.68 +<h4>Uptime</h4>
    3.69 +
    3.70 +<pre class="package">
    3.71 +<?php
    3.72 +system("uptime | sed 's/^\s*//'");
    3.73 +?>
    3.74 +</pre>
    3.75 +
    3.76 +<h4>Disk usage</h4>
    3.77 +<pre class="package">
    3.78 +<?php
    3.79 +system("df -h | sed '/^rootfs/d' | grep  '\(^/dev\|Filesystem\)'");
    3.80 +?>
    3.81 +</pre>
    3.82 +
    3.83 +<h4>Network</h4>
    3.84 +<pre class="package">
    3.85 +<?php
    3.86 +system("ifconfig eth0 | awk '{ if (/X packet/ || /X byte/) print }' | sed 's/^\s*//'");
    3.87 +?>
    3.88 +</pre>
    3.89 +
    3.90 +
    3.91 +<!-- End of content -->
    3.92 +</div>
    3.93 +
    3.94 +<!-- Footer -->
    3.95 +<div id="footer">
    3.96 +	Copyright &copy; <span class="year"></span>
    3.97 +	<a href="http://www.slitaz.org/">SliTaz</a> - Network:
    3.98 +	<a href="http://scn.slitaz.org/">Community</a>
    3.99 +	<a href="http://doc.slitaz.org/">Doc</a>
   3.100 +	<a href="http://forum.slitaz.org/">Forum</a>
   3.101 +	<a href="http://pkgs.slitaz.org/">Packages</a>
   3.102 +	<a href="http://bugs.slitaz.org">Bugs</a>
   3.103 +	<a href="http://hg.slitaz.org/">Hg</a>
   3.104 +	<p>
   3.105 +		SliTaz @
   3.106 +		<a href="http://twitter.com/slitaz">Twitter</a>
   3.107 +		<a href="http://www.facebook.com/slitaz">Facebook</a>
   3.108 +		<a href="http://distrowatch.com/slitaz">Distrowatch</a>
   3.109 +		<a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a>
   3.110 +		<a href="http://flattr.com/profile/slitaz">Flattr</a>
   3.111 +	</p>
   3.112 +</div>
   3.113 +
   3.114 +</body>
   3.115 +</html>