-
Notifications
You must be signed in to change notification settings - Fork 685
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
The stop event is not working in alpine (docker) #204
Comments
//Updated sysv_linux.go file for dokcer and kubernetes package service import ( type sysv struct { func newSystemVService(i Interface, platform string, c *Config) (Service, error) {
} func (s *sysv) String() string { func (s *sysv) Platform() string { var errNoUserServiceSystemV = errors.New("User services are not supported on SystemV.") func (s *sysv) configPath() (cp string, err error) { func (s *sysv) template() *template.Template {
} func (s *sysv) Install() error {
} func (s *sysv) Uninstall() error { func (s *sysv) Logger(errs chan<- error) (Logger, error) { func (s *sysv) Run() (err error) {
} func (s *sysv) Status() (Status, error) {
} func (s *sysv) Start() error { func (s *sysv) Stop() error { func (s *sysv) Restart() error { const sysvScript = `#!/bin/sh For RedHat and cousins:chkconfig: - 99 01description: {{.Description}}processname: {{.Path}}BEGIN INIT INFOProvides: {{.Path}}Required-Start:Required-Stop:Default-Start: 2 3 4 5Default-Stop: 0 1 6Short-Description: {{.DisplayName}}Description: {{.Description}}END INIT INFOcmd={{.Path}}{{range .Arguments}} {{.|cmd}}{{end}} name=$(basename $(readlink -f $0)) [ -e /etc/sysconfig/$name ] && . /etc/sysconfig/$name get_pid() { is_running() { case "$1" in |
There is a bug in the logic in which the service cannot be stopped. I'm using an alpine container.
File
service_sysv_linux.go
This function is using the existence of a file to tell if the process is still running.
When the stop event is called the program throws
Not stopped; may still be shutting down or shutdown may have failed
because at this point the file still exists. It will be deleted afterwards.Solution
This way if the file exists it will also check that the process is running
The way to reproduce it in the alpine container. You will have to run
apk add openrc --no-cache
The text was updated successfully, but these errors were encountered: