Solved

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

Posted on 2014-02-10
19
308 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
  • 9
  • 6
  • 3
  • +1
19 Comments
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 225 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 68

Expert Comment

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

Expert Comment

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

TY/SA
0
 
LVL 2

Author Comment

by:bcarlis
Comment Utility
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
Comment Utility
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
Comment Utility
./.profile
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 225 total points
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 2

Author Comment

by:bcarlis
Comment Utility
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
Comment Utility
"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
Comment Utility
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
Comment Utility
thanks for your input too Sandy!
0
 
LVL 68

Assisted Solution

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

Expert Comment

by:Sandy
Comment Utility
M sorry but i am laughing here :D :)  

Thanks guys :)
0
 
LVL 2

Author Closing Comment

by:bcarlis
Comment Utility
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
Comment Utility
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
Comment Utility
Got it!
Thx N!
0
 
LVL 2

Author Comment

by:bcarlis
Comment Utility
Just created another question :)

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

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

772 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now