1826417 Members
3768 Online
109692 Solutions
New Discussion

Re: Script Query

 
Hunki
Super Advisor

Script Query

I have two scripts to run and shutdown jboss called run.sh and shutdown.sh.

We have two environments running on the same box - develop and test. We need jboss to be up and running for either one of them .To point the jboss to either environments , I need to make a minor change to a file called oracle-ds.xml , just change the oracle SID in that file and also change the username and passwd for the DB in that file.


The standard distro scripts are attached herewith.

I need to make a change to the script so that I can restart the jboss logged in through the different userids for each environment.( called dev and test userids ) and it should automatically pick up the environment depending on the userid which is being used to run it. Can some incorporate the change in this script.

Thanks!
6 REPLIES 6
Hunki
Super Advisor

Re: Script Query

Here are the scripts attached.
Peter Nikitka
Honored Contributor

Re: Script Query

Hi,

the content of the attached files does not contain any references to the above mentioned file oracle-ds.xml .
2nd, I cannot find a reference to LOGNAME, USER or other environment related stuff there, as well.

This makes it difficult to provide solutions...

There IS a reference to a non-default configuration file:
>>
# Read an optional running configuration file
if [ "x$RUN_CONF" = "x" ]; then
RUN_CONF="$DIRNAME/run.conf"
fi
if [ -r "$RUN_CONF" ]; then
. "$RUN_CONF"
fi
<<

What about setting
RUN_CONF=/path/to/my/configuration.conf
?

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Hunki
Super Advisor

Re: Script Query

Here is what I have :

Single box with JBOSS installed , to make it run for either of the two environments ( which have two different userids - dev and test ) I need to make a change in a file $JBOSS_HOME/server/default/deploy/oracle-ds.xml.
In my $JBOSS_HOME/server/default/deploy , i have created two more files by the name :
oracle-ds.xml.dev and oracle-ds.xml.test so that in my run.sh script I can have a way of determining thru which user i m running the jboss ( whoami ) and then overwrite the oracle-ds.xml and then start jboss.

The pieces which are missing are needed inside that script.
OldSchool
Honored Contributor

Re: Script Query

Ok, in run.sh, after JBOSS_HOME is defined:

if [ $LOGNAME -s "dev" ]
then
cp $JBOSS_HOME/server/default/deploy/oracle-ds.xml.dev \
$JBOSS_HOME/server/default/deploy/oracle-ds.xml
else
cp $JBOSS_HOME/server/default/deploy/oracle-ds.xml.test \
$JBOSS_HOME/server/default/deploy/oracle-ds.xml
fi


you could also use symbolic links.

NOTE: This has NOT been tested, as I don't have Oracle or J-Boss
OldSchool
Honored Contributor

Re: Script Query

BTW: make that

if [ $LOGNAME = "dev" ]

OldSchool
Honored Contributor

Re: Script Query

Based on the points assigned, the answers given didn't solve your issues, so what's missing?