Skip to content

Commit

Permalink
Use systemctl reenable command to enable services
Browse files Browse the repository at this point in the history
We use reenable command (the command is a combination of disable+enable) to reset symlinks for the unit and make sure that only symlinks that are currently
configured in the [Install] section exist for the service.

Signed-off-by: Yury Kulazhenkov <[email protected]>
  • Loading branch information
ykulazhenkov committed Apr 12, 2024
1 parent 1841fbe commit 359282a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/host/internal/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ func (s *service) EnableService(service *types.Service) error {
}
defer exit()

// Enable service
_, _, err = s.utilsHelper.RunCommand("systemctl", "enable", service.Name)
// Enable the service
// we use reenable command (the command is a combination of disable+enable) to reset
// symlinks for the unit and make sure that only symlinks that are currently
// configured in the [Install] section exist for the service.
_, _, err = s.utilsHelper.RunCommand("systemctl", "reenable", service.Name)
return err
}

Expand Down

0 comments on commit 359282a

Please sign in to comment.