Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to run tracd (Trac in standalone mode) with custom template for multiple repository list:

$ tracd -p 8080 -e /my/projects/path

For custom template, I need an environment variable (as said here):

$ export TRAC_ENV_INDEX_TEMPLATE=/path/to/template

My problem is, that I need to run tracd as another user. Now I have:

$ sudo -u devel tracd -d -p 8080 -e /my/projects/path 

Running like devel there's no environment variable and it displays the project list on default template. I tried the obvious:

$ sudo -u devel export TRAC_ENV_INDEX_TEMPLATE=/path/to/template
sudo: export: command not found

Is my approach to this completely wrong, or I can solve this with setting another user's environment variable?

share|improve this question
    
There's another obvious one: $ sudo -u devel bash and then export, which solves my problem, but I'd like to hear your opinion on this. –  Martin Tóth Nov 30 '10 at 16:45

1 Answer 1

up vote 2 down vote accepted

If you can run arbitrary commands as the devel user, a common idiom is

sudo -u devel env TRAC_ENV_INDEX_TEMPLATE=/path/to/template tracd -d -p 8080 -e /my/projects/path

If you have root permissions, you can tell sudo to retain the environment variable with the env_keep directive, e.g.

Defaults>devel: env_keep=TRAC_ENV_INDEX_TEMPLATE
share|improve this answer
    
env_keep is great, thank You! –  Martin Tóth Dec 1 '10 at 10:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.