The user "bin" doesn't have a home directory, or if it does, it's not the one shared by root, and so there is no profile to load. You can fix this by going into the passwd table and giving bin a home directory, such as "/root" or "/" or a new directory like "/home/bin" and installing an appropriate .*shrc file there.
Hi Thanks for the reply, I have the bin direcotry and when the run the start.sh script file it's running fine but when am running the start.sh using the root shell by using the su command it's not working
When you run su as you explained, it tries to load the environment of "bin". If you want root's environment instead, use:
su bin -c start.sh
This will use the current environment but run start.sh as user bin. If you want to run it with root's environment, you must do as I described in my previous post.
When i run the below command i want's bin environment varibales loaded but it's not loading so my process getting failed with the the reason NoClassDefination found error
I understood you, you said when we run the su command with "-" you are saying it's will load the bin's profile but in my case it's not loading the bin's profile it's taking the root's environment variables only
First, identify the path that bin is using for home. Then, ensure that there is a .profile for bin:
ls -la /path_to_bin's_home_directory/bin
Then, write this script to see how the environment is changed using the ". /path/.profile" to change your environment.
#!/usr/bin/sh
/usr/bin/env > /tmp/default.environmentOutput
# This is where you will source the profile for your user
. /path_to_bin's_home_directory/bin/.profile
/usr/bin/env > /tmp/bin.environmentOutput
EDIT: Run using this command:
su - bin -c "/path_to_your_script/envCheck.sh"
/EDIT
This will create two files in /tmp
The first will show you the current environment variables.
The second will show you the NEW environment variables when you source the profile.
Test that - if you see a difference between the two files in /tmp, then you will see what the previous poster's are recommending. If you do not, then there is likely something wrong with the profile that you are sourcing - or you may be sourcing the wrong one.