Fred Stluka on 12 Mar 2013 13:42:42 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Setting an environment variable for servers on Linux...


PLUG folks,

What's the best way to set an environment variable on Linux, so that
it is found not only by shells, but also for servers processes like
Apache?

I have created:
    /etc/profile.d/hhl.sh
        export HHL_ENVIRONMENT=test
    /etc/profile.d/hhl.csh
        setenv HHL_ENVIRONMENT test
so now when any user logs in with any sh- or csh-based shell, the
env var is defined.

However, Apache and other servers are launched at boor time
via scripts and symlinks in /etc/rc.d, and they do NOT pick up
the env var.

Is there a single place to define it so all processes see it?  Or should
I just add the line:
    . /etc/profile.d/hhl.sh
to each of the appropriate files in:
    /etc/rc.d/init.d

I googled a bit and didn't find any better answer.

Any thoughts?  Thanks!
--Fred
------------------------------------------------------------------------
Fred Stluka -- mailto:fred@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
------------------------------------------------------------------------
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug