Defining variables at boot time

Hi,

I'm looking for advice on where is the best place on Solaris to put a script that will setup system vairables prior to any users loging in. I've tried /etc/rc3.d without much success as the variables do not appear in the output from an env command.

I want the system to have these variables set without any user intervention.

Thanx.

From the man pages:

The basic environment is initialized to:

      HOME=your-login-directory
      LOGNAME=your-login-name
      PATH=/usr/bin:
      SHELL=last-field-of-passwd-entry
      MAIL=/var/mail/your-login-name
      TZ=timezone-specification

 For Bourne shell and Korn shell logins, the  shell  executes
 /etc/profile  and $HOME/.profile, if it exists.  For C shell
 logins, the shell executes  /etc/.login,  $HOME/.cshrc,  and
 $HOME/.login.   The  default  /etc/profile  and  /etc/.login
 files check quotas \(see  quota\(1M\)\),  print  /etc/motd,  and
 check  for  mail.   None  of the messages are printed if the
 file $HOME/.hushlogin  exists.   The  name  of  the  command
 interpreter  is  set  to - \(dash\), followed by the last com-
 ponent of the interpreter's path name, for example, -sh.

Any system wide variables you want all 'users' to have should be placed in the /etc/profile and/or /etc/.login. Any 'user' specific (all Oracle DBA) should be set up on the individual profile or login in the home directory.

Oops, deleting my reply since thehoghunter beat me to it, and quite a good reply!

I've tried putting the entries in /etc/profile but when I login and use the env command to display the variables the entries aren't there.

Thanx.

Which version of Solaris? How are you logining in - console - telnet - rsh/rlogin - ssh ? What is the shell being used?

Please give an example of one of the variables attempting to be set (copy from the /etc/profile as it may just be a typo)

env will show all variables that have been enabled for exporting with the export command. If a variable has not been flagged for export, it will not be shown by env, but you can see it with "set".

Code as follows from /etc/profiles

#ident "@(#)profile 1.17 95/03/28 SMI" /* SVr4.0 1.3 */

# The profile that all logins get before using their own .profile.

trap "" 2 3
export LOGNAME PATH

if [ "$TERM" = "" ]
then
if /bin/i386
then
TERM=AT386
else
TERM=sun
fi
export TERM
fi

# Login and -su shells get /etc/profile services.
# -rsh is given its environment in its .profile.

case "$0" in
-sh | -ksh | -jsh)

    if [ ! -f .hushlogin ]
    then
            /usr/sbin/quota
            \#       Allow the user to break the Message-Of-The-Day only.
            trap "trap '' 2"  2
            /bin/cat -s /etc/motd
            trap "" 2

            /bin/mail -E
            case $? in
            0\)
                    echo "You have new mail."
                    ;;
            2\)
                    echo "You have mail."
                    ;;
            esac
    fi

esac

umask 022
trap 2 3
CLASSPATH=/ianf
export CLASSPATH

I'm using Solaris 2.6

I'm loging in on telnet and console.

Thanx.

This should work for both sh and ksh. If you are using csh, then it needs to be in /etc/.login