Solved

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

Posted on 2014-02-10
19
320 Views
Last Modified: 2014-02-11
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
0
Comment
Question by:bcarlis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 6
  • 3
  • +1
19 Comments
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 225 total points
ID: 39848669
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
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 75 total points
ID: 39848781
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
 
LVL 2

Author Comment

by:bcarlis
ID: 39848887
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39848892
Please take care of the Java paths! They're certainly not standard AIX!
0
 
LVL 13

Expert Comment

by:Sandy
ID: 39849463
to see existing path use #set command and accordingly modify the same.

TY/SA
0
 
LVL 2

Author Comment

by:bcarlis
ID: 39849834
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
 
LVL 2

Author Comment

by:bcarlis
ID: 39849871
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
 
LVL 13

Assisted Solution

by:Sandy
Sandy earned 50 total points
ID: 39849945
./.profile
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 225 total points
ID: 39850007
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
 
LVL 2

Author Comment

by:bcarlis
ID: 39850019
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
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 225 total points
ID: 39850056
"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
 
LVL 2

Author Comment

by:bcarlis
ID: 39850143
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
 
LVL 2

Author Comment

by:bcarlis
ID: 39850147
thanks for your input too Sandy!
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 225 total points
ID: 39850157
Glad it worked - but who is "Joe" ?
0
 
LVL 13

Expert Comment

by:Sandy
ID: 39850168
M sorry but i am laughing here :D :)  

Thanks guys :)
0
 
LVL 2

Author Closing Comment

by:bcarlis
ID: 39850170
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
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39850200
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
 
LVL 2

Author Comment

by:bcarlis
ID: 39850248
Got it!
Thx N!
0
 
LVL 2

Author Comment

by:bcarlis
ID: 39850296
Just created another question :)

AIX - Can you verify my assumption? Create Script for Service (daemon)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question