initial commit
This commit is contained in:
		
							
								
								
									
										21
									
								
								PHP_Scripts/check number of cpu/num_processors.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								PHP_Scripts/check number of cpu/num_processors.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
<?php
 | 
			
		||||
$cmd = "uname";
 | 
			
		||||
$OS = strtolower(trim(shell_exec($cmd)));
 | 
			
		||||
 | 
			
		||||
switch($OS){
 | 
			
		||||
   case('linux'):
 | 
			
		||||
      $cmd = "cat /proc/cpuinfo | grep processor | wc -l";
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
   case('freebsd'):
 | 
			
		||||
      $cmd = "sysctl -a | grep 'hw.ncpu' | cut -d ':' -f2";
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
   default:
 | 
			
		||||
      unset($cmd);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if ($cmd != ''){
 | 
			
		||||
   $cpuCoreNo = intval(trim(shell_exec($cmd)));
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
		Reference in New Issue
	
	Block a user