So I have an application I am deploying to an Ubuntu 12 server. My application has several "parts" to it:

There's a web server, run as part of an upstart script There are cron jobs There are sometimes command-line utilities which I want to run when ssh-ing into the production machine

What I want is a single place to specify a list of environment variables (MY_APP_HOME, MY_APP_CONFIG_1, etc...), which will be picked up by all of those above-mentioned "parts": by the upstart script, by the cron jobs, by the login shell when I ssh into the machine.

So, questions:

1) Where's the right place to place these? Specifically -- is it /etc/environment? Isn't that only for login sessions?

2) If it is /etc/environment -- I notice I can't use substitutions there, or run logic. Is there any place I can do that? A set of shell commands that get source'd?

  • 1
    Normally you would update your upstart script, cron jobs, and utilities to read from a config file of your own doing; rather than modify the global config. Oct 1, 2013 at 14:45

1 Answer 1


For simple programs /etc/myapp e.g. /etc/wgetrc Complex programs use a directory /etc/myapp or /etc/myapp.d e.g. /etc/apache2 or /etc/logrotate.d A .d in directory names typically indicates a directory containing many configuration files or scripts for a particular situation

I think its cleaner to use your own files and to set them for a user in /home/user/.bashrc than to change system wide options. If you must set it systemwide then in /etc/profile.d/myapp.sh


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .