fleet/assets/scripts/enable-scripts-macos.sh
Noah Talerman a85a66272d
Enable scripts remotely w/o re-deploying fleetd (#33169)
- @noahtalerman: I think we can merge in this PR before we dogfood the
scripts ourselves. Dogfood request is here:
https://github.com/fleetdm/fleet/issues/33170

---

- @noahtalerman: `customer-montague` was frustrated that they had to
re-deploy fleetd to enable scripts. At organizations that have a
third-party tool that can run scripts (other than Fleet), this is
avoidable! We want to document how to enable scripts remotely w/o
re-deploying fleetd.

More context:
https://github.com/fleetdm/fleet/issues/29193#issuecomment-3137337041
2025-11-12 10:39:48 -05:00

14 lines
671 B
Bash

#!/bin/bash
# Please don't delete. This script is used in the guide here: https://fleetdm.com/guides/scripts
if [ "$EUID" -ne 0 ]; then
echo "This script requires administrator privileges. Please run with sudo."
exit 1
fi
# Enable scrippts in Orbit environment variables (plist)
/usr/libexec/PlistBuddy -c "set EnvironmentVariables:ORBIT_ENABLE_SCRIPTS true" "/Library/LaunchDaemons/com.fleetdm.orbit.plist"
# Stop Orbit, wait for stop to complete, and then restart.
launchctl bootout system/com.fleetdm.orbit
while pgrep orbit > /dev/null; do sleep 1 ; done
launchctl bootstrap system $plist_path
echo "Fleet script execution has been enabled and Orbit restarted."