- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Chapter III - User's environments and /etc/profile
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2010 09:48 PM
02-23-2010 09:48 PM
I'd like to find out some details about environments, how to create them correctly and how to edit profile file.
1. to set temporary (for current session) environment. I needed to environment for ORACLE_HOME and ORACLE_SID.
i did:
# cd /u01/app/oracle/product/10.2.0/db_1/bin
# PATH=$PATH:.
# export PATH
# .oraenv
after this i could run oracle commands. When i changed user and came back, i couldnt do
$echo $PATH
PATH: .
in my 2nd server:
$echo $PATH returns
/usr/bin:/usr/sbin:/sbin
so, how could i have normal PATH value? in both of them i must have PATH for OS commands and ORACLE env.
Should i run PATH=PATH:/usr/bin:/usr/sbin:/sbin:/u01/app/oracle/product/10.2.0/db_1/bin or ? I know how to set one PATH(env), such as:
# cd /u01/app/oracle/product/10.2.0/db_1/bin
# PATH=$PATH:.
# export PATH
but i need to set whole environments with 1-2 command, i'd like to find out syntax of 'set environments'
2. First mark was to set temporary environments and syntax. Better to check and know what is running right now. But for the future i'd like to know - how to edit /etc/profile and ~/.profile, coz dont wanna always
set environments after relogin\restart\shutdown and so on. I checked /etc/profile and a bit difficult to find where to put environments..? + i couldnt find .profile in my home directory.
Regards,
Rustam
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2010 10:04 PM
02-23-2010 10:04 PM
Re: Chapter III - User's environments and /etc/profile
PATH=$PATH:.
to
PATH=$PATH:/u01/app/oracle/product/10.2.0/db_1/bin
and then try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2010 10:09 PM
02-23-2010 10:09 PM
Re: Chapter III - User's environments and /etc/profile
i think if you like to run some commands you need to set the variables for the shell, i always use only a dedicated user for oracle administration, so only this user need to set up this shell variables. of course if you have only one instance on the oracle you could set this variables as a global variable in /etc/profile.
mikap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2010 10:44 PM
02-23-2010 10:44 PM
Re: Chapter III - User's environments and /etc/profile
>so, how could i have normal PATH value?
You could do a:
source /etc/profile
That would restore the PATH to a "normal" value...
>i'd like to know - how to edit /etc/profile
You do not need to edit /etc/profile in order to alter PATH value. Change the file /etc/PATH .
Horia.
Horia.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2010 12:43 AM
02-24-2010 12:43 AM
Re: Chapter III - User's environments and /etc/profile
To source a file in a real shell you use:
. /etc/profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2010 01:02 AM
02-24-2010 01:02 AM
Re: Chapter III - User's environments and /etc/profile
# cd /u01/app/oracle/product/10.2.0/db_1/bin
# PATH=$PATH:.
# export PATH
# .oraenv
then it were possible to run them. But know i cant run OS commands, coz in PATH=PATH: .
on 2nd server i didn't run any command yet, there PATH=/usr/bin:/usr/sbin:/sbin
So how can i have set
PATH=/usr/bin:/usr/sbin:/sbin:/u01/app/oracle/product/10.2.0/db_1/bin
through the CLI?
+ 2nd way, should i add these parameters in /etc/profile or /etc/path ?
i have special user for oracle DBA.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2010 01:16 AM
02-24-2010 01:16 AM
Re: Chapter III - User's environments and /etc/profile
PATH=/usr/bin:/usr/sbin:/sbin:/u01/app/oracle/product/10.2.0/db_1/bin
You type that exact line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2010 01:20 AM
02-24-2010 01:20 AM
Re: Chapter III - User's environments and /etc/profile
$PATH=PATH:/usr/bin:/usr/sbin:/sbin:/u01/app/oracle/product/10.2.0/db_1/bin
$export PATH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2010 01:23 AM
02-24-2010 01:23 AM
Re: Chapter III - User's environments and /etc/profile
It is the other way:
PATH=$PATH:...
Horia.
Horia.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2010 01:53 AM
02-24-2010 01:53 AM
Re: Chapter III - User's environments and /etc/profile
It depends on how many user's want this in their path vs how many don't.
Special users should add it to their own ~/.profile.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2010 02:32 AM
02-24-2010 02:32 AM
Re: Chapter III - User's environments and /etc/profile
----
>>>> It depends on how many user's want this in their path vs how many don't.
Honestly, i dont know. I just have 2 users, root and oracle. These are just DB server and will not be other services. So should i set these environments for global or just oracle? Could u give me an idea\advice?
P.S. Yesterday, i e-mail to person who used before this server and he answered that there probably might be environments in the bash_profile,or in the bashrc, or in the .profile. How can i check bash_profile and bashrc? (whereis and find didnt help).
Regards,
Rustam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2010 02:40 AM
02-24-2010 02:40 AM
Re: Chapter III - User's environments and /etc/profile
bash_profile can be found on $HOME directory from every user having bash as the shell. I doubt that you are using bash on HP-UX.
bashrc also is related to bash shell.
Those are Linux common shells.
On HP-UX you are using by default bourne shell
This shell is using profile (actually it is .profile) on the same $HOME directory for each user.
man sh-bourne
Horia.
Horia.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2010 02:44 AM
02-24-2010 02:44 AM
Re: Chapter III - User's environments and /etc/profile
I was talking about bash.
Horia.
Horia.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2010 04:09 AM
02-24-2010 04:09 AM
Re: Chapter III - User's environments and /etc/profile
> Horia: On HP-UX you are using by default bourne shell
No, you are using the Posix shell. The old Bourne shell is long gone. HP-UX uses the Posix shell (see the manpages for 'sh-posix').
Normal users use '/usr/bin/sh' which is compiled with dynamic libraries and minimizes the running memory footprint. The root account has the '/sbin/sh' as the default shell since this is compiled with static libraries that do not require the '/usr' filesystem to be mounted during startup.
Never change 'root's default shell (in '/etc/passwd') from '/sbin/sh' to anything else. To do so may leave you with an un-bootable system.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2010 08:54 PM
02-24-2010 08:54 PM
Re: Chapter III - User's environments and /etc/profile
Then you just modify ~/.profile of the user that needs those extra PATH directories.
As Horia said, ~ is a shortcut for $HOME.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2010 10:05 PM
02-24-2010 10:05 PM
Re: Chapter III - User's environments and /etc/profile
Thank you for the necessary correction, James.
Like bourne shell, posix is using .profile and /etc/profile.
Anyway, this would lead to the following obvious observation: Should find out what shell is using the oracle user. If it is a bourne, korn or standard posix shell, you should look for profile files (should be $HOME/.profile). If it a csh, then you should look for .cshrc
If the shell is bash then you should look for .bash_profile. But if you did not find /etc/bashrc file, then probably bash is not installed on your system.
Horia.
Horia.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2010 10:17 PM
02-25-2010 10:17 PM
Re: Chapter III - User's environments and /etc/profile
I read some e-books about setting of user's environment and found out some details.
now i know different between /etc/profile and ~/.profile and when each one runs.
I found out interesting things. All environments which are i set through the CLI and found in ~./bash_profile, not in ~./profile. So ex-DBA set them in ~./bash_profile before. As far as i know ~./bash_profile runs when my shell is bash, right? i checked and found that my current SHELL is SH
SHELL="/sbin/sh"
SHLVL="3"
TERM="vt100"
TZ="WST-5WSTDST"
So should i change my SHELL then do i have to change these environments in another profile file? I mean does SH SHELL is ok? or which shell is suitable for use?
And what does CDE login mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2010 10:58 PM
02-25-2010 10:58 PM
Re: Chapter III - User's environments and /etc/profile
One observation: the variables that you set on your current shell
meaning by invoking:
VAR=value
export VAR
would exist only in that shell session. The profile file for the current user would not be affected by only setting a variable in the CLI.
>So ex-DBA set them in ~./bash_profile before.
This means that your ex-DBA used bash as a login shell.
>As far as i know ~./bash_profile runs when my shell is bash, right? i checked and found that my current SHELL is SH
SHELL="/sbin/sh"
SHLVL="3"
TERM="vt100"
TZ="WST-5WSTDST"
So you use the standard posix shell. This means that you must edit .profile for that user.
>So should i change my SHELL then do i have to change these environments in another profile file?
Yes, depending on the shell you use you need to update a different file. As usual, read manual page for the shell you use.
>I mean does SH SHELL is ok? or which shell is suitable for use?
Posix shell would be just fine. Just set the correct environment for your application.
Horia.
Horia.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2010 11:21 PM
02-25-2010 11:21 PM
Re: Chapter III - User's environments and /etc/profile
(This is typically called setting environment variables.)
>~./bash_profile runs when my shell is bash, right?
Yes.
>I checked and found that my current SHELL is SH: SHELL="/sbin/sh"
No, that just says your login shell is sh.
>So should I change my SHELL then do I have to change these environments in another profile file?
Only if you want $SHELL to be accurate.
>does SH SHELL is ok? or which shell is suitable for use?
Sure, the Posix shell is the default HP-UX shell.
>And what does CDE login mean?
That's what you have when you have a workstation and you use the graphical interface to login.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2010 03:34 AM
02-26-2010 03:34 AM
Re: Chapter III - User's environments and /etc/profile
Should i change ~/.profile for using SHELL sh or should i change shell to bash for using ~/.bash_profile?
1. if first way- sh, what should set\type in ~/.profile? i checked and found some operators
2. if the second - bash, what should i do to change shell from sh to bash?
regards and thank you,
rustam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2010 03:49 AM
02-26-2010 03:49 AM
SolutionYou have to set up the shell variables, as in
export ORACLE_HOME=...
export ORACLE_BASE=...
export ORACLE_SID=...
and so on.
>2. if the second - bash, what should i do to change shell from sh to bash?
You have to edit the file /etc/passwd
and modify the shell from the posix shell (usr/bin/sh) to bash
And edit the corresponding profile file.
Horia.
Horia.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2010 12:56 PM
02-26-2010 12:56 PM
Re: Chapter III - User's environments and /etc/profile
(BTW, the correct punctuation is "/", not "\". "\" is used in windows paths and on Unix for escaping.)
If you use a real shell (sh/ksh), ~/.profile should already be set up. You then can customize it the way you want, as Horia suggested.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2010 09:06 PM
03-01-2010 09:06 PM
Re: Chapter III - User's environments and /etc/profile
1. i checked passwd. The interpreter is /bin/bash
so why it didnt run the file .bash_pforile? or in passwd must be /usr/bin/bash?
2. my .bash_profile has these values:
# more .bash_profile
MANPATH=/usr/local/share/man:$MANPATH
EDITOR=vi
LESS="-efFKMX"
PS1='\u@\h \W\$ '
# DISPLAY=my_ip:666.0
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
ORACLE_SID=prod
ORACLE_HOSTNAME=oraprod
NLS_LANG=_.AL32UTF8
TMP=/tmp/$LOGNAME
TMPDIR=/tmp/$LOGNAME
#
PATH=/usr/local/bin:$PATH:$ORACLE_HOME/bin
export PATH MANPATH EDITOR LESS ORACLE_HOME ORACLE_SID ORACLE_HOSTNAME TMP TMPDI R NLS_LANG
test -f ~/.aliases && . ~/.aliases
dat=`date +%Y-%m-%d_%H%M`
umask 022
so if i want to sh/ksh i have to copy these values and paste in .profile or ..?
regards,
rustam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2010 11:03 PM
03-01-2010 11:03 PM
Re: Chapter III - User's environments and /etc/profile
>1. i checked passwd. The interpreter is /bin/bash
>so why it didnt run the file .bash_pforile?
The only situation when bash does not interpret the profile file, is when the binary itself is called with --noprofile option.
>or in passwd must be /usr/bin/bash?
You must know where your shell binary exists (if it is /bin/bash or /usr/bin/bash). But if you are able to log into the machine as this user, I believe /bin/bash is your binary used as the shell. (You can use `find` or `which` in order to find out the exact location)
>so if i want to sh/ksh i have to copy these values and paste in .profile or ..?
Yes, you must add the following variables into your .profile:
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
ORACLE_SID=prod
ORACLE_HOSTNAME=oraprod
NLS_LANG=_.AL32UTF8
export ORACLE_HOME ORACLE_SID ORACLE_HOSTNAME NLS_LANG
Horia.
Horia.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2010 01:18 AM
03-02-2010 01:18 AM
Re: Chapter III - User's environments and /etc/profile
>so why it didn't run the file .bash_profile? or in passwd must be /usr/bin/bash?
Does ~/.bash_profile exist?
Typically there is a tlink that sets /bin to /usr/bin, so both bash paths should be fine.
>export PATH MANPATH EDITOR LESS ...
If you don't have to worry about the Bourne shell, you may want to use:
export MANPATH=/usr/local/share/man:$MANPATH
>if I want to sh/ksh I have to copy these values and paste in .profile or ..?
You can just use ~/.profile and not ~/.bash_profile. Or only put your bash specific stuff in ~/.bash_profile.