AnalyseComputationalEnvironment.m: print out command that caused error as well as system response

time-shift
Johannes Pfeifer 2017-11-22 15:39:48 +01:00 committed by Stéphane Adjemian (Charybdis)
parent 3a6227387b
commit 4c7960fbdc
1 changed files with 29 additions and 7 deletions

View File

@ -284,14 +284,19 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
else
ssh_token = '';
end
[si2 de2]=system(['ssh ',ssh_token,' ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' ls ',DataInput(Node).RemoteDirectory,'/',RemoteTmpFolder,'/']);
command_string=['ssh ',ssh_token,' ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' ls ',DataInput(Node).RemoteDirectory,'/',RemoteTmpFolder,'/'];
[si2 de2]=system(command_string);
if (si2)
disp ('Remote Directory does not exist or is not reachable!')
skipline()
disp('ErrorCode 5.')
skipline(2)
disp('The command causing the error was:')
disp(command_string)
disp('The system returned:')
disp(de2)
skipline(2)
ErrorCode=5;
return
end
@ -317,13 +322,19 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
si2=[];
de2=[];
[si2 de2]=system(['dir \\',DataInput(Node).ComputerName,'\',DataInput(Node).RemoteDrive,'$\',DataInput(Node).RemoteDirectory,'\',RemoteTmpFolder]);
command_string=['dir \\',DataInput(Node).ComputerName,'\',DataInput(Node).RemoteDrive,'$\',DataInput(Node).RemoteDirectory,'\',RemoteTmpFolder];
[si2 de2]=system(command_string);
if (si2)
disp ('Remote Directory does not exist or it is not reachable!')
skipline()
disp('ErrorCode 5.')
skipline(2)
disp('The command causing the error was:')
disp(command_string)
disp('The system returned:')
disp(de2)
skipline(2)
ErrorCode=5;
return
end
@ -576,19 +587,30 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
end
if OStargetUnix
if RemoteEnvironment ==1
[si0 de0]=system(['ssh ',ssh_token,' ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' grep processor /proc/cpuinfo']);
command_string=['ssh ',ssh_token,' ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' grep processor /proc/cpuinfo'];
[si0 de0]=system(command_string);
else % it is MAC
[si0 de0]=system(['ssh ',ssh_token,' ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' sysctl -n hw.ncpu']);
command_string=['ssh ',ssh_token,' ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' sysctl -n hw.ncpu'];
[si0 de0]=system(command_string);
Environment1=2;
end
else
[si0 de0]=system(['ssh ',ssh_token,' ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' psinfo']);
command_string=['ssh ',ssh_token,' ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' psinfo'];
[si0 de0]=system(command_string);
end
else
[si0 de0]=system(['psinfo \\',DataInput(Node).ComputerName,' -u ',DataInput(Node).UserName,' -p ',DataInput(Node).Password]);
command_string=['psinfo \\',DataInput(Node).ComputerName,' -u ',DataInput(Node).UserName,' -p ',DataInput(Node).Password];
[si0 de0]=system(command_string);
end
end
if (si0)
disp('The command causing the error was:')
disp(command_string)
disp('The system returned:')
disp(de0)
skipline(2)
end
RealCPUnbr='';
% keyboard;