Tweak
This commit is contained in:
parent
98ee8b8de4
commit
f3dfb138ad
@ -5,12 +5,14 @@
|
|||||||
// Change directory to here
|
// Change directory to here
|
||||||
$thisDir=DirName(__FILE__);
|
$thisDir=DirName(__FILE__);
|
||||||
|
|
||||||
|
|
||||||
// Make sure we're root
|
// Make sure we're root
|
||||||
$whoami=Trim(Shell_Exec("whoami"));
|
$whoami=Trim(Shell_Exec("whoami"));
|
||||||
if($whoami!='root'){
|
if($whoami!='root'){
|
||||||
die("Please run as root (Currently: $whoami)");
|
die("Please run as root (Currently: $whoami)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// First parameter should be path to config file
|
// First parameter should be path to config file
|
||||||
$config_path=$argv[1];
|
$config_path=$argv[1];
|
||||||
if(!File_Exists($config_path)){
|
if(!File_Exists($config_path)){
|
||||||
@ -21,6 +23,7 @@ if(!Is_File($config_path)){
|
|||||||
}
|
}
|
||||||
$config_path = RealPath($config_path);
|
$config_path = RealPath($config_path);
|
||||||
|
|
||||||
|
|
||||||
// Second could be a test type (optional)
|
// Second could be a test type (optional)
|
||||||
$bStartTests_short=false;
|
$bStartTests_short=false;
|
||||||
$bStartTests_long=false;
|
$bStartTests_long=false;
|
||||||
@ -36,9 +39,11 @@ if(IsSet($argv[2])){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Load config
|
// Load config
|
||||||
$config = LoadConfig($config_path);
|
$config = LoadConfig($config_path);
|
||||||
|
|
||||||
|
|
||||||
// Show information about each drive
|
// Show information about each drive
|
||||||
foreach ($config['devices'] as $name=>$device ) {
|
foreach ($config['devices'] as $name=>$device ) {
|
||||||
|
|
||||||
@ -74,6 +79,7 @@ foreach($config['devices'] as $name=>$device){
|
|||||||
|
|
||||||
// Ask smartctl for status
|
// Ask smartctl for status
|
||||||
$command="smartctl --all --device {$device_safe} {$path_safe}";
|
$command="smartctl --all --device {$device_safe} {$path_safe}";
|
||||||
|
print "\nCOMMAND: {$command}";
|
||||||
$output_lines=false;
|
$output_lines=false;
|
||||||
Exec($command,$output_lines,$smart_return_code);
|
Exec($command,$output_lines,$smart_return_code);
|
||||||
$lines=Implode("\n",$output_lines);
|
$lines=Implode("\n",$output_lines);
|
||||||
|
Loading…
Reference in New Issue
Block a user