i am developing a web application using apache wickets. I need to call a
shell script residing on my local disk from java code.

this is the section of code under concern :

ProcessBuilder builder = new
ProcessBuilder("sh","/media/drive_/MtechDocuments/ProgramingNOTES/RunShellfromJAVA/test.sh");
                                 builder.redirectErrorStream(true);
                                    final Process process = builder.start();
                        }                       
                                 process.waitFor();

------

This is piece of code successfully runs fine and execute a shell when this
code is a part of java prgram residing anywhere on my laal disk. However,
when i make a jar file of a progeam , put in webapps folder , and start the
web application , it reports permission denied error on test.sh script. 

I then modify the line as :

ProcessBuilder builder = new ProcessBuilder("sudo", "-A",
"sh","/media/drive_/MtechDocuments/ProgramingNOTES/RunShellfromJAVA/test.sh");
and set the SUDO_ASKPASS env variable to script returning my sudo password ,
then it reports the following error :
sudo: 3 incorrect password attempts and script calling is failed. Again this
works correctly when i run the program outside the web development
environment , it is able to read my sudo password correctly at run time with
-A option. Why is it failing when running the same program from web
application ?  please help !! 


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/calling-shell-script-from-Wicket-java-program-tp4353583p4353583.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to