Why won't my daemon/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:
    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



Please sign in to leave a comment.