----------------------------------------------------------------
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!!!
----------------------------------------------------------------

Hi

Fernando and youself Kevin were quite right on the permissions issue.
I implemented the code given by kevin and the error log showed that the
permission denied to the batch script.

I have added the following code but stil it says that permission on t is
denied.

 sPath = new String("/usr/apache-d/htdocs/WebPages/Servlets/Admin");

 sPermForT = new String("chmod  2777" + sPath + "t");
 iResult = myRuntime.exec(sPermForT).waitFor();

 sPermCommand = new String("chmod 2777" + sPath + "cop.bat");
 iResult = myRuntime.exec(sPermCommand).waitFor();

My test batch script is just

mv  t   t1

Is there any additional settings to be done in the jServ?
Please reply

regards
Hiren

-----Original Message-----
From: Kevin Macclay <[EMAIL PROTECTED]>
To: Java Apache Users <[EMAIL PROTECTED]>
Date: Thursday, April 13, 2000 7:15 PM
Subject: Re: Batch Script running problem in apache


>----------------------------------------------------------------
>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!!!
>----------------------------------------------------------------
>
>I agree with Fernando, it's probably a permissions problem.  Often, I've
>found that capturing the output from the error stream of the process is
>helpful.  Otherwise you may be blind as to what the actual error is.  Also,
>standard output may give you some useful messages.  Here is sample code we
>use to execute a unix script and print out everything from the error
stream.
>
>                String command = { "/bin/csh", "-c",
>"/some/dir/scriptname" }
>                Process child = Runtime.getRuntime().exec(command);
>
>                // Wait for process to finish.
>                try {
>                    child.waitFor();
>                }
>                catch(InterruptedException e) {}
>
>                // Print out error messages.
>                BufferedReader childin = new BufferedReader(new
>InputStreamReader(child.getErrorStream()));
>
>                String line = "";
>                while ((line = childin.readLine()) != null)
>                    out.println(line + "<br>");
>
>                childin.close();
>
>Kevin
>
>-----Original Message-----
>From: Hiren Shah <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
><[EMAIL PROTECTED]>
>Date: Thursday, April 13, 2000 6:57 AM
>Subject: Batch Script running problem in apache
>
>
>>----------------------------------------------------------------
>>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!!!
>>----------------------------------------------------------------
>>
>>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.
>>
>>regards
>>Hiren
>>
>>
>>
>>
>>--
>>--------------------------------------------------------------
>>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]
>>
>
>
>
>--
>--------------------------------------------------------------
>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]
>
>



--
--------------------------------------------------------------
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]

Reply via email to