I have setup an Atlassian Bamboo deploy plan. One of its steps is to run a command to run automated UI tests written in Selenium for Python. This runs on a headless Centos 6 server. 
I had to install the X-server to simulate the existence of a display
I made the following commands run in the system boot so that the X-server is always started when the machine starts
Xvfb :1 -screen 1600x900x16
export DISPLAY=:1
The command task in the deployment plan simply invokes the following
/usr/local/bin/python3.5 .py
The funny thing is that when I run that directly from the command line it works perfect the the UI unit tests work. They start firefox and start dealing with the site.
On the other hand, when this is done via the deployment command I keep getting the error "The browser appears to have exited "
17-Apr-2016 14:18:23    selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details" As if it still does not sense that there is a display.
I even added a task in the deployment job to run X-server again but it came back with error that the server is already running.
This is done on Bamboo version 5.10.3 build 51020.
So, any ideas why it would fail within the deployment job?
Thanks,
I solved the problem by changing the task type from a command task to a script task. My understanding is that not all tasks are run in the sequence as they were defined in the job. If this is not the case, then it might be a bug in Bamboo.
Atlassian Bamboo command tasks not running correctly