Skip to content

Commit

Permalink
Mac: Enable daemon service to run as soon as user login
Browse files Browse the repository at this point in the history
This PR enable the daemon service to run user session basis, if system
reboot and user logs in then this service now auto started.

- User installs crc first time and do crc setup
- As part of the setup crc daemon is started by launchd
- User reboots
- Tray autostart with reboot but crc setup --check-only fails because launchd agent 'com.redhat.crc.daemon' is not running which triggers the on-boarding

fixes: #3104
  • Loading branch information
praveenkumar committed Apr 11, 2022
1 parent 79443cf commit 2af42b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/os/launchd/launchd_darwin.go
Expand Up @@ -41,6 +41,8 @@ const (
<string>{{ $value }}</string>
{{ end }}
</dict>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
`
Expand Down Expand Up @@ -112,12 +114,12 @@ func CheckPlist(config AgentConfig) error {

// LoadPlist loads a launchd agents' plist file
func LoadPlist(label string) error {
return runLaunchCtl("load", getPlistPath(label))
return runLaunchCtl("load", "-w", getPlistPath(label))
}

// UnloadPlist Unloads a launchd agent's service
func UnloadPlist(label string) error {
return runLaunchCtl("unload", getPlistPath(label))
return runLaunchCtl("unload", "-w", getPlistPath(label))
}

// RemovePlist removes a launchd agent plist config file
Expand Down

0 comments on commit 2af42b9

Please sign in to comment.