• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error While Running a Shell Script  RSS feed

 
Michael Scott
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have code that is intended to run a .bat file (shell script) on AIX. The primary steps in the code are listed below. The code generates an error unless it is delayed by a 'sleep' (step 8) prior to when the .bat file runs (step 9). (The error is "Error 404 - HTTP Web Server: Item Not Found Exception".) The 'sleep' must be excessively long in case there are several concurrent runs and so I'm looking to replace it. However, either replacing the 'sleep' with 'join' or making the methods for each of the following steps 'synchronized' still results in the same error.

I'd appreciate any other ideas of how the code might be modified to prevent an error in step 9. Thanks.

Steps:

1.) Create parameter used in some following steps.

2.) Create input file.

3.) Create .bat file.

4.) Add data to input file.

5.) Add commands to .bat file.

6.) Apply chmod to grant permissions to .bat file.

7.) Create exec to run .bat file.

8.) // Code to make thread sleep.

Runnable runnable = new BasicThread();
Thread thread = new Thread(runnable);
thread.start();
thread.sleep(12000);

9.) // Run bat command.

Process batChild = Runtime.getRuntime().exec(batCommand);
batChild.waitFor();
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!