This commit is contained in:
mike 2020-01-02 22:53:48 -08:00
parent 98ee8b8de4
commit f3dfb138ad

View File

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