----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files. Don't make us guess your problem!!!
----------------------------------------------------------------
> -----Original Message-----
> Hi
>
> I am using Apache Web Server .One of my servlets needs to execute a Batch
> script(unix).The code for Invoking the batch script is as follows ie
>
> try{
>
> Runtime myRuntime = Runtime.getRuntime();
> String sCommand,sPath;
> sPath="/usr/apache-d/htdocs/WebPages/Servlets/Admin/";
>
> sCommand = new String("sh " + sPath + "restart.bat");
> int iResult;
>
> iResult = myRuntime.exec(sCommand).waitFor();
> }
> catch(Exception e)
> {
> MyUtil.errorLog("Error in executing batch script");
> }
>
>
> where restart.bat is my shell script.
> When i try the above code in a normal java problem without apache
> web server
> it runs fine and executes the shell script.
>
> Please tell how to call the batch script from a servlet invoked by the
> apache web server.
>
Make sure that the permissions are set properly on your
script file. When you run java from the shell command-line,
you're typically running as root, but JServ will be running
as nobody/nobody. Check the man pages on chmod if you need
more info.
- Fernando
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]