ジョブの実行中にデーモンやサービスをバックグラウンドで実行させようとしても、起動後にサービスが利用可能でない場合があります。 これが発生する原因は、起動したバックグラウンドプロセスが、起動直後にプロセス自体を終了するステップを実行している可能性があるからです。 次に示す、Elasticsearch の起動ステップを例にとって考えてみます。
- 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:
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.
name: Elasticsearch
command:~/elasticsearch-2.4.3/bin/elasticsearch
background: true
Further reading:
https://circleci.com/docs/2.0/configuration-reference/#background-commands
コメント
サインインしてコメントを残してください。