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 background process exits successfully the step is considered finished, which ends the entire step.

- 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:

https://circleci.com/docs/2.0/configuration-reference/#background-commands

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

Comments

0 comments

Please sign in to leave a comment.