-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Ranjith,
On 9/19/16 12:39 AM, Ranjith Mandala wrote: > Below command fails to execute. Please let me know what I am doing > wrong. > > CommandLine cmdLine = new CommandLine("/bin/bash"); > cmdLine.addArguments(new String[] {"-c", "ls -l" }); > > > /bin/bash: ls -l: command not found Exit Value = 127 {127=Process > exited with an error: 127 (Exit value: 127)} Try running something simpler: you are using compound commands, and very likely don't have a PATH environment variable set for the shell. Try this: CommandLine cmdLine = new CommandLine("/bin/echo"); cmdLine.addArguments(new String[] {"foo" }); - -chris > On Sun, Sep 18, 2016 at 10:15 AM, <e...@zusammenkunft.net> wrote: >> Try /bin/su …/opt/hadoop/bin/hdfs… (use the absolute path of both >> commands) first. >> >> >> Gruss Bernd -- http://bernd.eckenfels.net From Win 10 Mobile >> >> >> >> Von: Ranjith Mandala Gesendet: Sonntag, 18. September 2016 19:11 >> An: Commons Users List Betreff: Re: Commons Exec with [exec]: >> {127=Process exited with an error: 127(Exit value: 127)} >> >> >> >> I googled but could not get much help. Can someone help on how to >> construct >> >> the below command using this API. Unfortunately, there is not >> much >> >> docs/examples to figure this out. It would be nice to put some >> samples on >> >> the doc. The basic commands work. The issue here is with the >> below commands. >> >> >> >> Thanks, >> >> RM. >> >> >> >> On Sunday, September 18, 2016, Russell Sherk >> <russell.sh...@roguewave.com> >> >> wrote: >> >> >> >>> Please Google error code 127. The command you are trying to run >>> may not be >> >>> on the path. >> >>> >> >>> --Russ >> >>> >> >>> On Sep 17, 2016 10:40 PM, Ranjith Mandala <ranji...@gmail.com >> >>> <javascript:;>> wrote: >> >>> I did but its still the same issue. Any recommendation on how >>> to construct >> >>> the below command? >> >>> >> >>> On Saturday, September 17, 2016, Paulo Roberto Massa Cereda < >> >>> cereda.pa...@gmail.com <javascript:;>> wrote: >> >>> >> >>>> 'ello, >> >>>> >> >>>> I'd try building the command arguments through a sequence of >> >>>> addArgument(...) calls instead of relying on parse(...), >>>> which could be >> >>>> very tricky (mainly due to quoting). >> >>>> >> >>>> Best, >> >>>> >> >>>> Paulo >> >>>> >> >>>> Em 17-09-2016 19:14, Ranjith Mandala escreveu: >> >>>> >> >>>>> On Sat, Sep 17, 2016 at 3:12 PM, Ranjith Mandala >>>>> <ranji...@gmail.com >> >>> <javascript:;>> >> >>>>> wrote: >> >>>>> >> >>>>>> Hi, >> >>>>>> >> >>>>>> I am trying to use the below command, but fails with Exit >>>>>> code 127. >> >>>>>> Any help is appreciated. >> >>>>>> >> >>>>>> String command = "su -l ambari-qa -c 'hdfs dfs -ls /' >> >>>>>> >> >>>>>> CommandLine cmdLine = CommandLine.parse(command); >> >>>>>> >> >>>>>> DefaultExecutor executor = new DefaultExecutor(); >> >>>>>> >> >>>>>> executor.execute(); >> >>>>>> >> >>>>>> {127=Process exited with an error: 127 (Exit value: >>>>>> 127)} >> >>>>>> >> >>>>>> Simple command like hdfs dfs -ls / works fine but the >>>>>> above does not >> >>>>>> work. >> >>>>>> >> >>>>>> Thanks, >> >>>>>> Ranjith. >> >>>>>> >> >>>>> >> >>>>> ------------------------------------------------------------------ - --- >> >>>>> >>>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org >> >>> <javascript:;> >> >>>>> For additional commands, e-mail: >>>>> user-h...@commons.apache.org >> >>> <javascript:;> >> >>>>> >> >>>>> >> >>>> ------------------------------------------------------------------- - -- >> >>>> >>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org >> >>> <javascript:;> >> >>>> For additional commands, e-mail: >>>> user-h...@commons.apache.org >> >>> <javascript:;> >> >>>> >> >>>> >> >>> >> >>> >> >> > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > For additional commands, e-mail: user-h...@commons.apache.org > -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJX4BU0AAoJEBzwKT+lPKRYEhsP/j4JQfe1aSYNOPsBGK9GTXqA ynYadGIf0Cr1DCCLIeaD/DafTuk3T8m+8tpjvwONNfaQjNjU2Z1LMAkzHo3Fg35d 6DKUhKVv0JRLEqLtBe3LYZ3XRyC/MxQbHsi2TxXOCP7b1MzMglZJzada/ptU1dac dtBPV1u9bfcOpbH9NomoRyvgCt9CnVRqlNqEWjMecG3rJs/olEEq6T/N62zZ+uiD jJxONrk6yr2fpSmcZJBgQPFL5w4QKgJWU6mYviR+WxX0UD+W1rzkXmxpQIc4PdaC 3ofeoH2suXPkWRdxx6DfNHecfvH+aRqLe8cCtevyb5PvfEIoKfAq/dmf5bZC8gEg tsht62/z9f2Vaun+X934asb1LJrnI2zeQOKoeMeU57RjbThljKg9+CDVyzwEtX66 do1iTnCjk+uUJoOnKM1ShT4+rRNuobEZIaXCXqpup5x9ey97ItY6+vHCMgN8iB7R q2xOYIhV79vsu1/6r4Ka70yt2J0qGGi8aaXAaQ747f/WUVcSHsMoW5Ejhe2+HG2g z5FPT/RpsNq+ikD+QpStsbWZ5nbsKMUpe9KRrb0wRYFth5XhKTc7qTrl8F/at83I 8hjEH21QeFKGwOLTWj5mz65fIgx0pJRCOkP7zCaZlZYUwKKF3mmpCZIaq9rtszrl 95e7XwEEa31HmFZElMDn =2nIP -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org