Rexec Issue

Hi Team,

I am executing some ksh scripts which inturn calls java files in AIX Environment. We have installed java6_64 which is in .profile. But when we execute from rexec its taking path from some different place that does not have java in $PATH variable. Can you please help me find out which $PATH needs to be changed to add java..

PWD=`pwd`
echo " HOME $HOME "
echo "PWD $PWD"
echo "SHELL : $SHELL "
echo "PATH $PATH "
echo "JAVA_CLASSPATH_VALUE : ${JAVA_CLASSPATH_VALUE} "
echo "JAVA_HOME $JAVA_HOME"
java -version

Output:

[home/test] >rexec -n 159.202.157.67 "./test.ksh"
Name (hostname_persistent:batch): batch2
Password (hostname_persistent:batch2):
 ./test.ksh[8]: java:  not found
 HOME /home/batch2
PWD /home/batch2
SHELL : /bin/ksh
PATH /usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java5/jre/bin:/usr/java5/bin
JAVA_CLASSPATH_VALUE :
JAVA_HOME
[/home/batch] >

Regards

Well, a users .profile is executed every time the user logs in. "rexec" is not a login, hence .profile is not executed.

Instead of putting these settings in .profile put it in ~/.kshrc , make it executable and explicitly load a ksh in the script to make sure a ksh is started:

#! /bin/ksh
# example for your ~/test.ksh (located on target machine)

print - "$ENV"              # this system variable should point to "~/.kshrc"
export ENV="~/.kshrc"       # make sure the correct value is set
print - "$PATH"             # find out if the path is set correctly
print - "$YOUR_ENV_VAR"     # check other set variable(s)

exit 0
# example for your ~/.kshrc on the target machine, make it executable!

. /etc/environment       # in AIX systems this is the file with system-wide settings
PATH=$PATH:/your/new/path ; export PATH
YOUR_ENV_VAR="some-value" ; export YOUR_ENV_VAR

I hope this helps.

bakunin

Thanks for your response.. I did the same today. and it worked fine...