The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
URL call from SHELL script chengwei Shell Programming and Scripting 35 4 Weeks Ago 05:04 PM
call constructor of java class in script thebladerunner Shell Programming and Scripting 1 4 Weeks Ago 12:23 PM
How to call Java by using shell script aaabbb123123 Shell Programming and Scripting 2 08-20-2008 11:02 PM
How to call a shell script from awk ? Amruta Pitkar Shell Programming and Scripting 1 04-20-2007 01:35 AM
how do i get my script to execute multiple commands? hvincent Shell Programming and Scripting 1 04-26-2006 05:19 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 09-02-2008
Registered User
 

Join Date: Sep 2008
Posts: 3
Thumbs up 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
Reply With Quote
Forum Sponsor
  #2  
Old 09-02-2008
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 734
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?
Reply With Quote
  #3  
Old 09-02-2008
Registered User
 

Join Date: Sep 2008
Posts: 3
Smile Re:Shell script to call multiple java commands

Quote:
Originally Posted by Smiling Dragon View Post
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.
Reply With Quote
  #4  
Old 09-02-2008
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 734
Post

Quote:
Originally Posted by vivekdn View Post
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.
Reply With Quote
  #5  
Old 09-02-2008
Registered User
 

Join Date: Sep 2008
Posts: 3
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?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:46 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0