Command Not found error 127

Nov 21, 2013 at 6:42 AM
Edited Nov 21, 2013 at 6:44 AM
When we are executing few command the below code is executing successfully but for few commands such as "server_mount ALL" , it is giving error code 127 and command not found error with message "bash: server_mount: command not found"

If we notice carefully the error message does not have ALL text. its only having server_mount . What could be the issue . is the problem with space before ALL

Please suggest a solution.

below is the code i am using I am using dotnet 3.5 latest dll
var client = new SshClient("12.xx.xx.xx", "rootxx", "xxxxx");
        client.Connect();

           string commandName = txtCommand.Text.ToString();
            SshCommand command = client.CreateCommand(commandName);
            command.CommandTimeout = new TimeSpan(24, 0, 0);
            commandResult = command.Execute();
            string error = command.ExitStatus.ToString();
            MessageBox.Show(error);
            MessageBox.Show(command.Error);
Nov 21, 2013 at 7:54 AM
What is "server_mount"?
I suspect it's an own written script or s.th like that?
Try using the absoulte path, e.g /usr/sbin/server_mount (or wherever the script is located).

Greetz
Nov 21, 2013 at 7:56 AM
Edited Nov 21, 2013 at 8:03 AM
The command which we are trying to run is "server_mount ALL". This is a command specific to the server and OS. This is such one of the commands which is having problem . My concern is whether the Space in the command is creating any issue.
Nov 21, 2013 at 8:34 AM
Don't think so.
As the error says: bash cannot find the command server_mount.
It never shows your options:

$ foo foo
bash: foo: command not found
$ bla bla
bash: bla: command not found

Try the absolut path.