View previous topic :: View next topic |
Author |
Message |
dno n00b
Joined: 30 Nov 2003 Posts: 4 Location: Asia / Taiwan / Taoyuan
|
Posted: Tue Jun 01, 2004 3:26 pm Post subject: INIT(8) Manual |
|
|
quoted from init manual Code: |
Init sets the following environment variables for all its children:
PATH /usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin
INIT_VERSION
As the name says. Useful to determine if a script runs directly
from init.
RUNLEVEL
The current system runlevel.
PREVLEVEL
The previous runlevel (useful after a runlevel switch).
CONSOLE
The system console. This is really inherited from the kernel;
however if it is not set init will set it to /dev/console by
default. |
but, when i trying access those variables with env commend
i just got nothing. what i messed ? |
|
Back to top |
|
|
sapphirecat Guru
Joined: 15 Jan 2003 Posts: 376
|
Posted: Tue Jun 01, 2004 5:50 pm Post subject: |
|
|
I'm pretty sure login cleans out the environment, so those variables are only accessible to things run directly from init itself. On Gentoo, that's the /sbin/rc script which manages runlevel changes. _________________ Former Gentoo user; switched to Kubuntu 7.04 when I got sick of waiting on gcc. Chance of thread necro if you reply now approaching 100%... |
|
Back to top |
|
|
dno n00b
Joined: 30 Nov 2003 Posts: 4 Location: Asia / Taiwan / Taoyuan
|
Posted: Tue Jun 01, 2004 6:45 pm Post subject: |
|
|
sapphirecat wrote: | I'm pretty sure login cleans out the environment |
and sshd cleans out those environment variables too
sorry, i did not mention i'm working through ssh
Code: | $ pidof sshd
9808 9805 30764 30761 1314
$ pstree -ap 1314
sshd,1314
|-sshd,30761
| `-sshd,30764
| `-bash,30765
| |-man,31662 init
| | `-sh,31665 -c ...
| | `-sh,31666 -c ...
| | `-less,31671
| |-man,31718 init
| | `-sh,31721 -c ...
| | `-sh,31722 -c ...
| | `-less,31727
| |-man,31967 proc
| | `-sh,31970 -c ...
| | `-sh,31971 -c ...
| | `-less,31976
| `-su,9788 -
| `-bash,9789
| `-emerge,9795 -O /usr/bin/emerge sync
| `-rsync,9804 --recursive --links --safe-links ...
| `-rsync,9879 --recursive --links --safe-links ...
`-sshd,9805
`-sshd,9808
`-bash,9809
`-pstree,10036 -ap 1314 |
environment variables still exist in here
Code: | # more /proc/1314/environ
CONSOLE=/dev/consoleTERM=linuxDEFAULTLEVEL=defaultCRITICAL_SERVICES=checkroot ho
stname modules checkfs localmountINIT_VERSION=sysvinit-2.84PATH=/bin:/sbin:/usr/
bin:/usr/sbin:/usr/local/sbin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/binRUNLE
VEL=3PWD=/PREVLEVEL=NBOOTLEVEL=bootSHLVL=1HOME=/SOFTLEVEL=defaultOLDSOFTLEVEL=bo
ot_=/sbin/start-stop-daemon |
all environment variables has been wipe out
Code: | # more /proc/9805/environ
[
n |
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|