DuztDruid
August 19th, 2010, 01:31 PM
I was under the impression that /etc/environment was the place to put variables if you wanted them to be available to all users at all times. But I just realized root which is running my service processes doesn't seem to load it.
My /etc/environment:
RAILS_ENV="production"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
When I ssh to the box as a sudo user I can echo $RAILS_ENV and get production. However if I "sudo -s" to open up a root shell $RAILS_ENV is suddenly blank.
"sudo -i" will let me have the variable there but when I run my service with "service god start" it still doesn't pick up the variable for use inside the process.
The process is configured to run at boot time automatically if the machine has to be rebooted so it's crucial that the environment can be picked up at that time as well.
Is there any simple way to achieve this or do I have to somehow manually load /etc/environment in my init scripts or in the daemon process itself?
(I'm running Ubuntu 10.04 server edition in a VirtualBox instance with the latest apt-get upgrade)
My /etc/environment:
RAILS_ENV="production"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
When I ssh to the box as a sudo user I can echo $RAILS_ENV and get production. However if I "sudo -s" to open up a root shell $RAILS_ENV is suddenly blank.
"sudo -i" will let me have the variable there but when I run my service with "service god start" it still doesn't pick up the variable for use inside the process.
The process is configured to run at boot time automatically if the machine has to be rebooted so it's crucial that the environment can be picked up at that time as well.
Is there any simple way to achieve this or do I have to somehow manually load /etc/environment in my init scripts or in the daemon process itself?
(I'm running Ubuntu 10.04 server edition in a VirtualBox instance with the latest apt-get upgrade)