Projet

Général

Profil

« Précédent | Suivant » 

Révision 0d4b6b89

Ajouté par jim-p il y a presque 10 ans

Display space usage for all mounted filesystems, not just /. Also display FS type and indicate if it's a RAM disk.

Voir les différences:

usr/local/www/includes/functions.inc.php
191 191
	return $temp_out;
192 192
}
193 193

  
194
function disk_usage() {
194
/* Get mounted filesystems and usage. Do not display entries for virtual filesystems (e.g. devfs, nullfs, unionfs) */
195
function get_mounted_filesystems() {
196
	$mout = "";
197
	$filesystems = array();
198
	exec("/bin/df -Tht ufs,zfs,cd9660 | /usr/bin/awk '{print $1, $2, $3, $6, $7;}'", $mout);
199

  
200
	/* Get rid of the header */
201
	array_shift($mout);
202
	foreach ($mout as $fs) {
203
		$f = array();
204
		list($f['device'], $f['type'], $f['total_size'], $f['percent_used'], $f['mountpoint']) = explode(' ', $fs);
205

  
206
		/* We dont' want the trailing % sign. */
207
		$f['percent_used'] = trim($f['percent_used'], '%');
208

  
209
		$filesystems[] = $f;
210
	}
211
	return $filesystems;
212
}
213

  
214
function disk_usage($slice = '/') {
195 215
	$dfout = "";
196
	exec("/bin/df -h | /usr/bin/grep -w '/' | /usr/bin/awk '{ print $5 }' | /usr/bin/cut -d '%' -f 1", $dfout);
216
	exec("/bin/df -h {$slice} | /usr/bin/tail -n 1 | /usr/bin/awk '{ print $5 }' | /usr/bin/cut -d '%' -f 1", $dfout);
197 217
	$diskusage = trim($dfout[0]);
198 218

  
199 219
	return $diskusage;

Formats disponibles : Unified diff