Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
* Quest: how to set global environment variables?
@ 2003-02-12 10:51 Albert
  2003-02-13  5:56 ` Joe Chung
  2003-02-13  9:40 ` TyBreaker
  0 siblings, 2 replies; 3+ messages in thread
From: Albert @ 2003-02-12 10:51 UTC (permalink / raw)


Dear all,

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
--------------------------------------------------

Best Regards,
A. John






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Quest: how to set global environment variables?
  2003-02-12 10:51 Quest: how to set global environment variables? Albert
@ 2003-02-13  5:56 ` Joe Chung
  2003-02-13  9:40 ` TyBreaker
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Chung @ 2003-02-13  5:56 UTC (permalink / raw)


"Albert" <kinace@hotmail.com> writes:

> Dear all,
> 
> 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
> --------------------------------------------------
> 
> Best Regards,
> A. John

How is the daemon process started?

In the script that starts the daemon is where you need to set the
environment variables.

Look at any /sbin/rc*.d/S* script and see how they set various
environment variables BEFORE invoking the daemon process.

-jc
-- 
(apply 'concat (reverse (list "com"
                              (char-to-string 46) "yahoo"
                              (char-to-string 64) "joechung")))


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Quest: how to set global environment variables?
  2003-02-12 10:51 Quest: how to set global environment variables? Albert
  2003-02-13  5:56 ` Joe Chung
@ 2003-02-13  9:40 ` TyBreaker
  1 sibling, 0 replies; 3+ messages in thread
From: TyBreaker @ 2003-02-13  9:40 UTC (permalink / raw)


> 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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-02-13  9:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-12 10:51 Quest: how to set global environment variables? Albert
2003-02-13  5:56 ` Joe Chung
2003-02-13  9:40 ` TyBreaker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox