mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Orbit: Add retries to launchctl bootstrap to fix issue with MDM push (#8187)
* Add retries to launchctl bootstrap to fix MDM push * Increment retries from 5 to 30
This commit is contained in:
parent
72cfdac634
commit
b016fc8a3a
2 changed files with 21 additions and 2 deletions
1
orbit/changes/add-retries-bootstrap-mdm-push
Normal file
1
orbit/changes/add-retries-bootstrap-mdm-push
Normal file
|
|
@ -0,0 +1 @@
|
|||
- Added `launchctl bootstrap` retries in Orbit `pkg` installer to fix MDM deployments of Orbit (when pushed with `InstallEnterpriseApplication`).
|
||||
|
|
@ -60,8 +60,26 @@ DAEMON_PLIST="/Library/LaunchDaemons/${DAEMON_LABEL}.plist"
|
|||
pkill fleet-desktop || true
|
||||
# Remove any pre-existing version of the config
|
||||
launchctl bootout "system/${DAEMON_LABEL}"
|
||||
# Add the daemon to the launchd system
|
||||
launchctl bootstrap system "${DAEMON_PLIST}"
|
||||
|
||||
# Add the daemon to the launchd system.
|
||||
#
|
||||
# We add retries because we've seen "launchctl bootstrap" fail
|
||||
# if the service is still running after bootout (in case the
|
||||
# service takes a bit longer to terminate gracefully).
|
||||
# We've seen this when deploying the package via an MDM server.
|
||||
#
|
||||
count=0
|
||||
while ! launchctl bootstrap system "${DAEMON_PLIST}"; do
|
||||
sleep 1
|
||||
((count++))
|
||||
if [[ $count -eq 30 ]]; then
|
||||
echo "Failed to bootstrap system ${DAEMON_PLIST}"
|
||||
exit 1
|
||||
fi
|
||||
echo "Retrying launchctl bootstrap..."
|
||||
done
|
||||
echo "Successfully bootstrap system ${DAEMON_PLIST}"
|
||||
|
||||
# Enable the daemon
|
||||
launchctl enable "system/${DAEMON_LABEL}"
|
||||
# Force the daemon to start
|
||||
|
|
|
|||
Loading…
Reference in a new issue