Troubleshooting why won't my daemon or service stay up?

You may want to run a daemon or service in the background during your jobs and find that the service isn't available after you've started it. You may be starting it as a background process which causes the run step to exit immediately after it's been started.

Take the example of starting Elasticsearch below:

- run: ~/elasticsearch-2.4.3/bin/elasticsearch -d

This results in the step only being active for one second.

Once the process that started Elasticsearch exits successfully, the step is considered finished.


To keep Elasticsearch running in the background, add the background: true attribute to this step as follows: 

- run:
    name: Elasticsearch
  command: ~/elasticsearch-2.4.3/bin/elasticsearch
    background: true

By starting Elasticsearch in the foreground and using the background: true attribute of the run key our Elasticsearch process will stay active for the duration of the job.

Further reading:

Was this article helpful?
3 out of 3 found this helpful



Article is closed for comments.