Shell script to call multiple java commands


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script to call multiple java commands
# 1  
Old 09-02-2008
MySQL Shell script to call multiple java commands

Hi,

I want to call multiple java commands through a .sh file. I have drafted one with my least knowledge. But its not working. Pls help. I am trying to run this from Sun Solaris (OS 5.10) server with 10g oracle database.

echo \* starting script AUTORUN
echo \* get the Monitor path
Monitorpath= /export/home1/users/test/Script/
echo \*Stopping the Monitors
curdir=`pwd`
cd $Monitorpath
$Monitorpath\java MonitorStopper -l
echo \*Starting Project
$Monitorpath\start "Project" java Project
echo \*Starting Engine
$Monitorpath\start "Engine" java Engine
echo \*Starting Monitor
$Monitorpath\start "Monitor" java Monitor
echo \*Starting Escalation
$Monitorpath\start "Escalation" java Escalation
echo \*Starting ResponseMonitor
$Monitorpath\start "Response" java ResponseMonitor

I am trying to give start so that each one opens in different window (works in DOS). Is there any other command in unix for start?

Regards,
Vivek
# 2  
Old 09-02-2008
What do you mean by "a different window"?
Do these java processes bring up GUIs? Or are they just outputting text and you want them each to run in a different terminal?
Are you running X11? (Required if you want to open any additional windows - be it another terminal or a java GUI).
Does "/export/home1/users/test/Script/start" actually exist?
# 3  
Old 09-03-2008
Bug Re:Shell script to call multiple java commands

Quote:
Originally Posted by Smiling Dragon
What do you mean by "a different window"?
Do these java processes bring up GUIs? Or are they just outputting text and you want them each to run in a different terminal?
Are you running X11? (Required if you want to open any additional windows - be it another terminal or a java GUI).
Does "/export/home1/users/test/Script/start" actually exist?
Hi,

Thanks for the reply. My requirement is that when i run the first command then some of my existing processes will get killed. Then i need to start all the processes one by one. As you have mentioned, on running the command : start "Project" java Project through DOS, a new command prompt will come and the process will run in it and the name of the window will be Project. Similarly for the other commands also. So that means i want my ouput details to be shown in a new terminal for each java command. Ys the path "/export/home1/users/test/Script" do exist and in this path only the java files resides. Request you to give suggestions.
# 4  
Old 09-03-2008
Java

Quote:
Originally Posted by vivekdn
Thanks for the reply. My requirement is that when i run the first command then some of my existing processes will get killed. Then i need to start all the processes one by one. As you have mentioned, on running the command : start "Project" java Project through DOS, a new command prompt will come and the process will run in it and the name of the window will be Project. Similarly for the other commands also. So that means i want my ouput details to be shown in a new terminal for each java command. Ys the path "/export/home1/users/test/Script" do exist and in this path only the java files resides. Request you to give suggestions.
By the looks of things, that means that there's no 'start' program in your test/Script dir, and I'm also assuming no 'java' in there either, so that'll be the simplest issue, just omit that as follows:
Code:
#!/bin/sh
echo "* starting script AUTORUN"
echo "* get the Monitor path"
Monitorpath= /export/home1/users/test/Script/
echo "*Stopping the Monitors"
curdir=`pwd`
cd $Monitorpath
java $Monitorpath\MonitorStopper -l
echo "*Starting Project"
java $Monitorpath\Project &
echo "*Starting Engine"
java $Monitorpath\Engine &
echo "*Starting Monitor"
java $Monitorpath\Monitor &
echo "*Starting Escalation"
java $Monitorpath\Escalation &
echo "*Starting ResponseMonitor"
java $Monitorpath\ResponseMonitor &

If you want the output from these to each display in a seperate window, you'll need to answer my other questions about your environment (see above), most importantly, X11 - if you aren't running that, you'll not be able to open multiple windows in that fashion.
# 5  
Old 09-03-2008
My env details are as follows - Sun Solaris (OS 5.10) server with 10g oracle database.
I dont have any idea about X11. If this helps in opening multiple windows then what change in addition is required in the code you have given me now?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check status of long running multiple curl commands in shell script

I am working on script. it reads a file which contains multiple lines Ex; curl --write-out %{http_code} --silent --output /dev/null http://hostname:port/input=1 curl --write-out %{http_code} --silent --output /dev/null http://hostname:port/input=2 curl --write-out %{http_code} --silent ... (2 Replies)
Discussion started by: oraclermanpt
2 Replies

2. Shell Programming and Scripting

How to call Oracle function with multiple arguments from shell script?

Dear All, I want to know how can i call oracle function from shell script code . My oracle function have around 5 input parameters and one return value. for name in *.csv; do echo "connecting to DB and start processing '$name' file at " echo "csv file name=$x" sqlplus -s scoot/tiger <!... (2 Replies)
Discussion started by: Balraj
2 Replies

3. Open Source

Help with writing Shell Script to automate process using multiple commands

Hello! Need help to write a Linux script that can be run from windows using command/Cygwin/any other way. I am new to scripting, actually i am trying to automate server health check like free disk space, memory along with few services status, if any services is not running then start services ,... (7 Replies)
Discussion started by: Sayed Ibrahim
7 Replies

4. Shell Programming and Scripting

How to catch errors in a shell script ( multiple commands )?

Hi I have a shell script like that Main() { DAY=$(date +"%d-%m-%Y") TIME=$(date +"%T") Command 1 Command 2 ... Command n } I would like to catch errors from all commands in Main() and write these errors into a file , something likes this: Main if < error > then echo... (3 Replies)
Discussion started by: bobochacha29
3 Replies

5. Shell Programming and Scripting

Call java program from shell and pass values

Hi All, Can anybody please help me with how can i call my java program from shell and also pass parameter along with it so that the program can interpret the value/int and update the database. Thanks in advance Neha (1 Reply)
Discussion started by: Neha Goyal
1 Replies

6. Programming

how to handle SQL exceptions to call script having args via java ?

Hi, i want to call shell script via java + in that shell script i m doing some sql operation by connecting to sqlplus . i want to return 0 if successful exeution of SQL operations else 1 ; is it possible ? #!/bin/sh Name=$1; export ORACLE_HOME $ORACLE_HOME/bin/sqlplus... (3 Replies)
Discussion started by: crackthehit007
3 Replies

7. Shell Programming and Scripting

how to call java prog from shell script

I have a java program to validate a XML file. I want to call this java program in a shell script which will be registered as concurrent program in oracle apps. Can anyone please let me know the step by step appraoch required to call java program in shell script like ....intial steps... (1 Reply)
Discussion started by: kcp_pavan
1 Replies

8. UNIX for Advanced & Expert Users

How to execute multiple unix commands in one session from java

Hi, Iam trying to code in java and wanted to run the commands in the Unix remote servers. I have the following code to run multiple GREP commands in a single session. But when i execute this, the first command executes successfully, whereas from the next line it says "Exception Occured... (1 Reply)
Discussion started by: gravi2020
1 Replies

9. Shell Programming and Scripting

call constructor of java class in script

Hi, Is it possible to call the constructur of a java class in a shell script? I know you can call static methods, but can you also call the constructor? tnx. (1 Reply)
Discussion started by: thebladerunner
1 Replies

10. Shell Programming and Scripting

How to call Java by using shell script

Hi All, I am new to shell script, just wanted you guy to help. How do i call a java program by using shell script, pls give some samle code for it, thank you ver much. (2 Replies)
Discussion started by: aaabbb123123
2 Replies
Login or Register to Ask a Question