I have a web application writen in jsp/servlets & tomcat 7.It will run on linux systems.
I want to run a bash script with root privilages(gksudo ./myScript.sh).
My script is under /web directory.(/web/myScript.sh).
How can i do that??
I have seen some examples, i managed to run bash shell command(like ls), but didn’t managed to execute the script!! How i can set as working directory the /web/ ?
Check out the following method to figure out how to get the path to your script:
To execute a script, you can use the Runtime class like this:
I’ve never tried running a script using sudo (or gksudo), so you’ll have to play around with that.
Hopefully you can just add it to the array before the script name.