Host : <>
Output : {}
ExitStatus : 127
An internet search says that ExitStatus 127 is "command not found".
Instead of running bash, can you run a dir or ls command to verify that you can see the script file.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Context:
Steps:
PowerShell Script:
function remoteConnectEngine($secUsername, $VmPassword, $remoteMachine) {
$password = ConvertTo-SecureString $VmPassword -AsPlainText -Force;
$pscredential = New-Object -TypeName System.Management.Automation.PSCredential("$secUsername", $password);
removeExistingSession
$cmd = "bash ./datadisk01/PerfAutomation/startJMeterServer.sh"
foreach ($rm in $remoteMachine) {
$currentSessionID = New-SSHSession -ComputerName $rm -Credential $pscredential
Invoke-SSHCommand -SessionId $currentSessionID.SessionId -Command $cmd
}
}
function removeExistingSession {
$remove = Get-SSHSession
if ($null -eq $remove -or $remove -eq 0) {
Write-Host "There is no active session opened previously !!!"
}
else {
Write-Host "There are few existing session opened with the previous connection, removing them!!!"
foreach ($existingSessionID in $remove.SessionId){
$removeTheSession = Remove-SSHSession -SessionId $existingSessionID
if($removeTheSession) {
Write-Host "Existing Session ID" $existingSessionID "has been removed successfully!!!"
}
else {
Write-Host "There is a problem with removing the existing session with ID" $removeTheSession
}
}
}
}
function connectionDetails($targetMachine) {
$LoadAgentUserName = "TestUser";
$LoadAgentVMPassword = "<Password>";
$vm_Machine = $targetMachine;
remoteConnectEngine $LoadAgentUserName $LoadAgentVMPassword $vm_Machine
}
function startJMeterServer {
$loadAgentMachine = 'npd-test-app03'
connectionDetails $loadAgentMachine
}
startJMeterServer
Shell Script:
#!/bin/bash
startJMeterServer () {
echo "Change current directory to the JMeter !!!";
cd /datadisk01/PerformanceTool/apache-jmeter-5.3/bin || exit;
echo "Validating, if there is any JMeter server is running in the current machine?";
if [[ -z $(ps -ef |grep "jmeter-server"|grep -v grep) ]]
then
echo "There is no JMeter process is running!!!";
else
java_processID=$(ps -e -H -o pid,comm | awk '$2 ~ /jmeter-server/ { print $1}')
echo "There is a already java process running !!!";
if [[ -z "$java_processID" ]]
then
echo "No process is running with signature JMeter";
else
echo "Process Id for running JMeter process is:""$java_processID";
echo "Killing the existing JMeter Server process !!!"
#ps -e -H -o pid,comm | awk '$2 ~ /test-server/ { print $1}' | xargs kill -9
if [ $? -eq 0 ]; then
echo "JMeter Server killed successfully";
else
echo "Error while terminating the JMeter server process";
fi
fi
fi
#ls -lrt
}
startJMeterServer
I am getting:
Host : <>
Output : {}
ExitStatus : 127
Host : <>
Output : {}
ExitStatus : 127
An internet search says that ExitStatus 127 is "command not found".
Instead of running bash, can you run a dir or ls command to verify that you can see the script file.
Hi there,
Value 127 is returned by /bin/sh when the given command is not found within your PATH system variable and it is not a built-in shell command. In other words, the system doesn't understand your command, because it doesn't know where to find the binary you're trying to call.
Here is a thread as well which discusses the same issue and you can try out some troubleshooting steps from this and see if that helps you to sort the Issue.
https://powerusers.microsoft.com/t5/Building-Flows/Execute-Power-Shell-scripts-through-Power-Automate-flows/td-p/731472
--If the reply is helpful, please Upvote and Accept it as an answer--