Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully stop a service with service stop #3568

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stffabi
Copy link

@stffabi stffabi commented Nov 1, 2020

- What I did

Make sure the "service stop" commands tries to gracefully stop the task. Currently the task
was immediately killed, this is especially a problem if e.g. the service is a docker in docker service.

For docker in docker, docker won't try to stop all the containers in it gracefully, furthermore it won't cleanup
it's pid file and the service can't be restarted anymore.

- How I did it

"service stop" now first sends a SIGTERM to the service task and waits for it to be
stopped. If it doesn’t stop in the time specified, a SIGKILL will be send to the task.

This is analogous how "docker stop" works.

- How to verify it

Use docker in docker as a service, start e.g. caddy container in docker and tail the log of the caddy container. Then
in another session stop the service with "service stop docker" and verify that the caddy container gets
stopped gracefully.

- Description for the changelog

Gracefully stop a service with service stop

- A picture of a cute animal (not mandatory but encouraged)

First send a SIGTERM to the service task and wait for it to be
stopped. If it doesn’t stop in the time specified, a SIGKILL
will be send to the task.

Signed-off-by: stffabi <stffabi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant