diff --git a/daemon/daemon.go b/daemon/daemon.go index 471d52e..f786385 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -119,8 +119,23 @@ func (dc *DaemonConfig) SyncWithAssignments(configChecksums map[string]string, c runnerBackend := runner.GetBackend() if backend != nil && !runnerBackend.EqualSettings(backend) { log.Infof("[%s] Updating process configuration", runner.Name()) + runnerServiceType := runnerBackend.ServiceType runner.SetBackend(*backend) configChecksums[backend.Id] = "" + if backend.ServiceType != runnerServiceType { + log.Infof("Changing process runner (%s -> %s) for: %s", + runnerServiceType, backend.ServiceType, backend.Name) + dc.DeleteRunner(id) + dc.AddRunner(*backend, context) + } + // XXX + // We should, but cannot trigger a restart here. + // + // If a backend gets renamed, it expects the configuration under a new path. + // Therefore, we don't copy the configuration from the old backend to the new backend, + // but keep it empty. + // This will trigger `services.checkForUpdateAndRestart()` to write a new + // configuration and then restart the runner. } // cleanup backends that should not run anymore diff --git a/daemon/exec_runner.go b/daemon/exec_runner.go index e0a57a8..3ff3bb4 100644 --- a/daemon/exec_runner.go +++ b/daemon/exec_runner.go @@ -109,6 +109,8 @@ func (r *ExecRunner) GetBackend() *backends.Backend { func (r *ExecRunner) SetBackend(b backends.Backend) { r.backend = b r.name = b.Name + r.stderr = filepath.Join(r.context.UserConfig.LogPath, b.Name+"_stderr.log") + r.stdout = filepath.Join(r.context.UserConfig.LogPath, b.Name+"_stdout.log") r.exec = b.ExecutablePath r.args = b.ExecuteParameters r.restartCount = 1