Question

What could be wrong here, so i get always the exitValue 125? :

function cPWinKerb(userPW,userUID)
{
try
{
var execStr = new Array("su","-c","/home/shellscript.sh",userPW,userUID);
var runtime = java.lang.Runtime.getRuntime();
var proc = runtime.exec(execStr);
var l="";
l = execStr + " --- " + l + "RESULT: [" + proc.waitFor() + " " + proc.exitValue() + "]";
return l;
}
catch (e)
{
return String(e);
}
finally
{
}
}

I get as result:

RESULT: [125 125]".

I tried different things:

  • with su -c and without
  • using "" for the argument after su -c and without ""
  • using ~ in front of the path
  • giving "/home/shellscript.sh userPW userUID" as a full string

I am running out of options to try.

If a call "su -c /home/shellscript.sh userPW userUID" from command promt it works fine.

Was it helpful?

Solution

There was something wrong inside the shellscript.sh . Everything was fine with the exec call :) .

Now it works as expected.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top