Gentoo Archives: gentoo-dev

From: Georgi Georgiev <chutz@×××.net>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] init.d-scripts don't see stuff from /etc/profile.env
Date: Wed, 24 Aug 2005 11:37:27
Message-Id: 20050824113507.GA107350@lion.gg3.net
In Reply to: Re: [gentoo-dev] init.d-scripts don't see stuff from /etc/profile.env by Roy Marples
1 maillog: 24/08/2005-11:04:42(+0100): Roy Marples types
2 > On Wed, 2005-08-24 at 17:27 +0900, Georgi Georgiev wrote:
3 > > > uberpc init.d # ./test start
4 > > > * Starting service test
5 > > > LANG=en_GB.utf8
6 > > > LANGUAGE=en_GB.utf8
7 > > > set | grep LANG
8 > > > * Service test started OK
9 > >
10 > > Try unsetting the variable in your own shell first.
11 > >
12 > > lion init.d # /etc/init.d/test restart
13 > > LANG=en_US.utf8
14 > > set | grep LANG
15 > > lion init.d # LANG=C /etc/init.d/test restart
16 > > LANG=C
17 > > set | grep LANG
18 > > lion init.d # env -u LANG /etc/init.d/test restart
19 > > set | grep LANG
20 > > \
21 >
22 > Um, that's kinda like behaviour by design unless anyone can tell me
23 > otherwise.
24 >
25 > /etc/env.d/* just set shell variables, so if you change one then you
26 > need to
27 >
28 > env-update
29 > source /etc/profile
30 > /etc/init.d/thisdaemon restart
31 >
32 > To refresh the daemon that needs the vars
33
34 The init script will not see those variables when it is run by /sbin/rc
35 which is in turn run by init which is what happens on boot. The
36 environment is empty then, and if you want to reproduce it accurately
37 for your tests, you should do:
38
39 env -i /etc/init.d/test restart
40
41 It does see variables in /etc/rc.conf though:
42
43 lion ~ # echo LANGTEST=testme >> /etc/rc.conf
44 lion ~ # env -i /etc/init.d/test restart
45 * Caching service dependencies ... [ ok ]
46 LANGTEST=testme
47 set | grep LANG
48
49 --
50 / Georgi Georgiev / Honesty is the best policy, but insanity /
51 \ chutz@×××.net \ is a better defense. \
52 / +81(90)2877-8845 / /

Replies

Subject Author
[gentoo-dev] Re: init.d-scripts don't see stuff from /etc/profile.env "Sven Köhler" <skoehler@×××.de>