mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-05-15 00:50:25 +02:00
Fix restart command when ctrld service was already stopped
This commit is contained in:
committed by
Cuong Manh Le
parent
125b4b6077
commit
854a244ebb
+4
-7
@@ -550,13 +550,10 @@ func initCLI() {
|
||||
return
|
||||
}
|
||||
initLogging()
|
||||
tasks := []task{{s.Restart, true}}
|
||||
// On Windows, s.Restart will return error unless service is running.
|
||||
if runtime.GOOS == "windows" {
|
||||
tasks = []task{
|
||||
{s.Start, false},
|
||||
{s.Restart, true},
|
||||
}
|
||||
|
||||
tasks := []task{
|
||||
{s.Stop, false},
|
||||
{s.Start, true},
|
||||
}
|
||||
if doTasks(tasks) {
|
||||
dir, err := userHomeDir()
|
||||
|
||||
@@ -63,6 +63,16 @@ func (s *sysV) Stop() error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *sysV) Restart() error {
|
||||
if !s.installed() {
|
||||
return service.ErrNotInstalled
|
||||
}
|
||||
// We don't care about error returned by s.Stop,
|
||||
// because the service may already be stopped.
|
||||
_ = s.Stop()
|
||||
return s.Start()
|
||||
}
|
||||
|
||||
func (s *sysV) Status() (service.Status, error) {
|
||||
if !s.installed() {
|
||||
return service.StatusUnknown, service.ErrNotInstalled
|
||||
|
||||
Reference in New Issue
Block a user