why can't upstart run 'source bin/activate'?

Question:

upstart won’t activate my virtualenv for some reason.

This is how I run it

script
    # My startup script, plain old shell scripting here.
    cd path/to/env
    source bin/activate
    ....
end script

the virtualenv runs fine when started manually

Why does this not work?

Asked By: Calum

||

Answers:

So I’ve worked it out, for some reason upstart doesn’t like using ‘source’ so I changed the line from:

source bin/activate

to

. bin/activate

and that works, don’t know why though, so would be interested if someone could explain this

Answered By: Calum

source is a bash built-in command but only a posix “special” command.

Upstart runs sh -e when executing the script sections.

sh shell doesn’t understand source, only .

Answered By: Jeffrey Martinez
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.