AW: [suse-oracle] Different environment in initscripts? 2007-12-05 - By Silviu Marin-Caea
Back On Wednesday 05 December 2007 01:40:07 pm Klier, Martin (A.T.U) wrote: > Hi, > > the /etc/profile construct is not sourced by init scripts.
It does not appear to be that. su - oracle will actually run /etc/profile.d/oracle.sh
from info:/su `-' `-l' `--login' Make the shell a login shell. This means the following. Unset all environment variables except `TERM', `HOME', and `SHELL' (which are set as described above), and `USER' and `LOGNAME' (which are set, even for the super-user, as described above), and set `PATH' to a compiled-in default value. Change to USER's home directory. Prepend `-' to the shell's name, intended to make it read its login startup file(s).
from man:/bash When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
And I have added some "echo" debugging lines to some scripts, to verify the process is working as I expect. This is the output, over a reboot cycle, with added comments.
reboot
# this is su - oracle -c "echo shutdown immediate | sqlplus" oracle_db stop 15:16:09 running /etc/profile.d/oracle.sh 15:16:09
# this is env from inside su - oracle ORA_NLS10=/opt/oracle/product/10gR2/db/nls/data ORACLE_SID=prod2 ORACLE_BASE=/opt/oracle ORACLE_HOME=/opt/oracle/product/10gR2/db
# this is supposed to completely halt CRS init.crs stop 15:17:13 running /etc/profile.d/oracle.sh 15:17:13
# this unsets the environment oracle_kparm stop 15:17:31 running /etc/profile.d/oracle.sh 15:17:31
# these are processes that CRS should have stopped PID TTY TIME CMD 29617 ? 00:00:00 ons 29618 ? 00:00:00 ons # shutdown completed
# after boot.local the services will start /etc/init.d/boot.local 15:21:14 oracle_kparm start 15:21:40 running /etc/profile.d/oracle.sh 15:21:40 init.crs start 15:21:41 running /etc/profile.d/oracle.sh 15:21:42 running /etc/profile.d/oracle.sh 15:21:42 running /etc/profile.d/oracle.sh 15:21:42 running /etc/profile.d/oracle.sh 15:21:42 running /etc/profile.d/oracle.sh 15:22:26 running /etc/profile.d/oracle.sh 15:22:44 running /etc/profile.d/oracle.sh 15:22:46
-- To unsubscribe, email: suse-oracle-unsubscribe@(protected) For additional commands, email: suse-oracle-help@(protected) Please see http://www.suse.com/oracle/ before posting
|
|