From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,44c7a666aee27018 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-02-13 01:42:19 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!freenix!deine.net!lon-transit.news.telstra.net!news.telstra.net!newsfeeds.bigpond.com!not-for-mail From: TyBreaker User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.unix.tru64 Subject: Re: Quest: how to set global environment variables? References: <1045047297.37541@sky.aect.cuhk.edu.hk> In-Reply-To: <1045047297.37541@sky.aect.cuhk.edu.hk> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <9CJ2a.46612$jM5.116992@newsfeeds.bigpond.com> Date: Thu, 13 Feb 2003 20:40:34 +1100 NNTP-Posting-Host: 144.134.117.169 X-Trace: newsfeeds.bigpond.com 1045128709 144.134.117.169 (Thu, 13 Feb 2003 20:31:49 EST) NNTP-Posting-Date: Thu, 13 Feb 2003 20:31:49 EST Organization: Telstra BigPond Internet Services (http://www.bigpond.com) Xref: archiver1.google.com comp.unix.tru64:9534 > Would like to set a global environment variable for a daemon process. Daemon > process is placed in /usr/sbin, owned by root:system. > -- What should the right way to do so? > -- Which file should keep those "export" statement? > > A simple script with export statement, named "S999TEST" are placed in > /sbin/rc2.d and /sbin/rc3.d. But, after system is rebooted, still not make > any affect. > > S999TEST: > -------------------------------------------------- > TEST_ENV_003=AlbertoErica003 > export TEST_ENV_003 > -------------------------------------------------- ENVIRONMENT variables are purely a shell concept. Each account that actually has a shell specified in it's passwd entry and creates processes would need any global environment variables in it's .profile (sh) or .cshrc (csh) etc such that any process they create picks up these environment variables when a new shell is spawned. Having said this there are very few reasons why you should want to place environment variables in such a global position. It is better practice to do as the other post said and create a startup script for your daemon and place any environment variables within it. Even better again would be to develop your daemon further and add the ability for it to accept arguments on the command line to specify any info it might need.