How would I translate this Linux script to an AIX script?

Hi All,

How would I translate this Linux script to an AIX script?

# User specific aliases and functions
export AS_JAVA=/usr/java/jdk1.7.0_45
export JAVA_HOME=/usr/java/jdk1.7.0_45
export JAVA_BINDIR="${JAVA_HOME}/bin"
echo $PATH | /bin/grep -q -v "${JAVA_BINDIR}"
if [ $? -eq 0 ]; then export PATH="${PATH}:${JAVA_BINDIR}"; fi

export GLASSFISH_PARENT=/u01/oracle/glassfish
export GLASSFISH_HOME=/u01/oracle/glassfish/glassfish
echo $PATH | /bin/grep -q -v "${GLASSFISH_HOME}/bin"
if [ $? -eq 0 ]; then export PATH="${PATH}:${GLASSFISH_HOME}/bin"; fi

Open in new window


I am going in circles.. I am a PL/SQL programmer.. trying to get APEX installed.
Thank you so much,

Bill
LVL 2
BILL CarlisleAPEX DeveloperAsked:
Who is Participating?
 
woolmilkporcConnect With a Mentor Commented:
To make the new Java version known globally (i.e. to all users) you must edit the /etc/environment file.

It contains a "PATH=" statement which you'll have  to change according to your needs.

Attention: Please do't use "export" in /etc/environment, use only statements in the form "VAR=value". Everything contained in /etc/environment is automatically exported at the start of any shell.

.profile is the right place in AIX to set a PATH for the single user whose home directory the .profile is in.

Since the current directory is not in the PATH by default you must execute it like this:

. ./.profile

(i.e. dot space dot slash dot profile)
0
 
woolmilkporcConnect With a Mentor Commented:
Where is your problem?

As far as it's for the syntax - this script will work under AIX (ksh) just "as is".

The installation path of Java is a bit different under AIX. It's "/usr/java<version>/", which means: there is no "java" subdirectory inbetween. Check with "ls -ld /usr/java*"

AIX does not have an "/u01" directory by default, but of course you can create such a directory and work with it as usual.

So again, where is the problem? Do you get any error message?
0
 
TintinConnect With a Mentor Commented:
So long as your paths are correct, there should be nothing you need to change in the script, although I'd write it as:

# User specific aliases and functions
export AS_JAVA=/usr/java/jdk1.7.0_45
export JAVA_HOME=/usr/java/jdk1.7.0_45
export JAVA_BINDIR="${JAVA_HOME}/bin"
echo $PATH | /bin/grep -q "${JAVA_BINDIR}" || export PATH=$PATH:$JAVA_BINDIR

export GLASSFISH_PARENT=/u01/oracle/glassfish
export GLASSFISH_HOME=/u01/oracle/glassfish/glassfish
echo $PATH | /bin/grep -q "${GLASSFISH_HOME}/bin" || export PATH=$PATH:GLASSFISH_HOME

Open in new window

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
BILL CarlisleAPEX DeveloperAuthor Commented:
Thank you for your response
I will be testing in the morning
I just took for granted that it would be big-time different
Thanks again,
Bill
0
 
woolmilkporcCommented:
Please take care of the Java paths! They're certainly not standard AIX!
0
 
SandyCommented:
to see existing path use #set command and accordingly modify the same.

TY/SA
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
Ok, it was weird that when I changed to glassfsh user it didn't automatically change from root directory / to /home/glassfsh, but I figured that out.. ha, don't know much even about unix..
:)

$ ls -ld /usr/java*
drwxr-xr-x    5 root     dba            512 Feb 18 2007  /usr/java131
drwxr-xr-x    7 oradev   oradev    512 Nov 11 2010  /usr/java14
drwxr-xr-x    7 bin      bin             512 Jul 15 2011  /usr/java5
drwxr-xr-x    7 bin      bin             512 Jul 15 2011  /usr/java5_64
drwxr-xr-x    7 bin      bin             512 Jun 28 2013  /usr/java6
drwxr-xr-x    7 bin      bin             512 Dec  3 15:37 /usr/java71

so, I used /usr/java71 as my java path


# User specific aliases and functions
export AS_JAVA=/usr/java71
export JAVA_HOME=/usr/java71
export JAVA_BINDIR="${JAVA_HOME}/bin"
echo $PATH | /bin/grep -q -v "${JAVA_BINDIR}"
if [ $? -eq 0 ]; then export PATH="${PATH}:${JAVA_BINDIR}"; fi

export GLASSFISH_PARENT=/u01/oracle/glassfish
export GLASSFISH_HOME=/u01/oracle/glassfish/glassfish
echo $PATH | /bin/grep -q -v "${GLASSFISH_HOME}/bin"
if [ $? -eq 0 ]; then export PATH="${PATH}:${GLASSFISH_HOME}/bin"; fi

this is what I used, think I will keep it to what our doc has.. as long as it work fine.

$ exit

# whoami
root
# su glassfsh
$ java -version
java version "1.1.8"

Ok, I exited glassfsh, then went back in as glassfsh to run the .profile I just updated (because I forgot the command to run it)

then as you see did a java -version
why is it showing "1.1.8" ??
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
Yep, it is not seeing the java71 version

*******************************************************************************
*                                                                             *
*                                                                             *
*  Welcome to AIX Version 6.1!                                                *
*                                                                             *
*                                                                             *
*  Please see the README file in /usr/lpp/bos for information pertinent to    *
*  this release of the AIX Operating System.                                  *
*                                                                             *
*                                                                             *
*******************************************************************************
# su glassfsh
$ pwd
/
$ cd /home/glassfsh
$ pwd
/home/glassfsh
$ /u01/oracle/glassfish/bin/asadmin start-domain
-jar: illegal argument
Usage: java [-options] class

where options include:
    -help             print out this message
    -version          print out the build version
    -fullversion      print out the full version information
    -v -verbose       turn on verbose mode
    -debug            enable remote JAVA debugging
    -noasyncgc        don't allow asynchronous garbage collection
    -verbosegc        print a message when garbage collection occurs
    -noclassgc        disable class garbage collection
    -cs -checksource  check if source is newer when loading classes
    -ss<number>       set the maximum native stack size for any thread
    -oss<number>      set the maximum Java stack size for any thread
    -ms<number>       set the initial Java heap size
    -mx<number>       set the maximum Java heap size
    -D<name>=<value>  set a system property
    -classpath <directories separated by colons>
                      list directories in which to look for classes
    -prof[:<file>]    output profiling data to ./java.prof or ./<file>
    -verify           verify all classes when read in
    -verifyremote     verify classes read in over the network [default]
    -noverify         do not verify any class

 DEFAULTS:
    -ss: 256K, -oss: 400K, -ms: 1M, -mx: 32M
$

Open in new window


doesn't seem to be running the ,profile

$ vi .profile   (just saw the file, edited it, saved it - it is there)
$ . .profile
ksh: .profile:  not found
$

. .profile the wrong command to run it from this shell?
0
 
SandyConnect With a Mentor Commented:
./.profile
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
Okay, so if they don't want to run the whole system with Java 7 then I would just leave it in the .profile for glassfish, right?
But why, when I logged totally out, and then log totally back in as glassfish It still didn't pick up the new changes in my profile?
0
 
woolmilkporcConnect With a Mentor Commented:
"su glassfish" alone does not start a login shell and thus does not run ".profile" (and doesn't take you to glassfish's $HOME either, by the way).

You must run "su - glassfish" (note the dash - it's "su space dash space username)
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
Thx Joe, I usually do use the dash but I thought I got an error early on with this AIX so I stopped using it. Probably was some other error..

Great, I'm in! Wohoo! You are the best..

# su - glassfsh
[YOU HAVE NEW MAIL]
$ java -version
java version "1.1.8"
$ /u01/oracle/glassfish/bin/asadmin start-domain
Waiting for domain1 to start ......................
Successfully started the domain : domain1
domain  Location: /u01/oracle/glassfish/glassfish/domains/domain1
Log File: /u01/oracle/glassfish/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.

Open in new window

0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
thanks for your input too Sandy!
0
 
woolmilkporcConnect With a Mentor Commented:
Glad it worked - but who is "Joe" ?
0
 
SandyCommented:
M sorry but i am laughing here :D :)  

Thanks guys :)
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
Ha! I have another post going with a brother printer and a virus and his name was Joe!
Just tried looking up you name but I guess you don't have one.. :)

What is a woolmilkporc?
0
 
woolmilkporcCommented:
If you're interested - I explained "woolmilkporc" in my profile:
 http://www.experts-exchange.com/M_1730518.html

And if you want to know my real name - check EE's MVE Gamma class.

Thx for the points!
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
Got it!
Thx N!
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
Just created another question :)

AIX - Can you verify my assumption? Create Script for Service (daemon)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.