Defining variables at boot time


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Defining variables at boot time
# 1  
Old 01-07-2002
Question 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.
# 2  
Old 01-07-2002
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.
thehoghunter
# 3  
Old 01-07-2002
Oops, deleting my reply since thehoghunter beat me to it, and quite a good reply!
Jimbo
# 4  
Old 01-07-2002
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.
# 5  
Old 01-07-2002
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)
thehoghunter
# 6  
Old 01-07-2002
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".
Jimbo
# 7  
Old 01-07-2002
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.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Boot time driver conflict

I have a Microdia web cam. Some times it won't work if and only if there is a "HV7131R image sensor detected" statement in the boot up. In this case when I try to get a .png snapshot all I get is a frame full of what appears to be white noise only it is mostly green. Here is the command I am... (0 Replies)
Discussion started by: slak0
0 Replies

2. Shell Programming and Scripting

Defining Dynamic Number of Variables in a Bash Script

Code: $ cat test.bash #!/bin/bash job=$1 steps=$2 num=$(echo "$@" | wc -w) Example Submission: $ ./test.bash BS01 3 1 2 3 What: (2 Replies)
Discussion started by: mkastin
2 Replies

3. Ubuntu

Upgrading 9.04 version 9.10 - slow boot time

After upgrading my 9.04 version to the 9.10 my boot time duplicates. I donīt know the reason why the time of boot gets to the double. Someone ??? Thx. (1 Reply)
Discussion started by: diesan
1 Replies

4. HP-UX

I want to get machine boot up time

I use the uptime command,but it only show how long system has been up up 18 days but I want the this format machine boot time YYYY-MM-DD hh:mm:ss does any command can get that or how to i use program to do this (6 Replies)
Discussion started by: alert0919
6 Replies

5. HP-UX

HP UX start process at boot time

When I get start program at boot I read which run level /sbin/rcx.d runlevel=0.....x only read directory which directory name has UpperCase 'S' is not enough someone says that I need to reference another file which file I need to reference 1)/etc/rc.config.d/all file which parameter... (4 Replies)
Discussion started by: alert0919
4 Replies

6. Shell Programming and Scripting

defining variables

Hey all, I was wondering if someone would take a look at this script I'm working on. I don't know if i have the syntax correct for my variables and if the for loop is written correctly. any assistance would be greatly appreciated. #!/usr/bin/bash ###########################################... (12 Replies)
Discussion started by: em23
12 Replies

7. Programming

How to get time since last boot?

How do I get the number of tics or seconds since the last boot? How do I convert tics to seconds? Thanks, Siegfried (3 Replies)
Discussion started by: siegfried
3 Replies

8. UNIX for Dummies Questions & Answers

Defining Variables

I'm trying to define a variable named sin I already have a variable named cos, which has the value "hello" I want sin to have the value of "hellothere", so sin would be something like sin = $cos & "there" but I'm not sure that I know the syntax. Can anyone help? :confused: (4 Replies)
Discussion started by: sailorliones
4 Replies

9. BSD

Reduce boot-time delay on FreeBSD?

Say for instance, I would like to reduce the delay/waiting time for the boot-time menu from 10 seconds to 5 seconds, how would I go about doing it? From what I've been able to find, entering "autoboot 5" into the right file would take care of that for me, but the man pages are unclear as to... (1 Reply)
Discussion started by: DownSouthMoe
1 Replies

10. UNIX for Advanced & Expert Users

start a process at boot up time

Hi, I have a program that check the IP address and automatic update it to the DNS server. I would like to run this program when the computer bootup after pppd get a connection. How do I add it to the init file. Does any one have any information of how to do it. I run a Linux Mandrake as a... (1 Reply)
Discussion started by: vtran4270
1 Replies
Login or Register to Ask a Question