The issue is about how Self Service tracks policy execution status.
When a user clicks "Run" in Self Service, the Self Service app launches the jamf daemon to execute the policy and keeps an internal reference to track the execution result. Self Service is a macOS GUI app that relies on the Dock and WindowServer to maintain its process state.
When the script runs killall Dock, macOS terminates the Dock process and launchd restarts it. This causes a brief disruption to all GUI apps' window management — including Self Service itself. During this disruption, Self Service loses its internal tracking state for the in-progress policy execution. Since it never receives a proper completion callback:
- Self Service reports "Item Failed" — it defaults to failure because the tracking was interrupted
- Policy log stays Pending — the execution result was never submitted back to the Jamf Pro server
The script did execute successfully (the Dock did restart), but the reporting mechanism was broken.
Fix: Background the killall command so the script exits cleanly first, giving the jamf daemon time to report success before the Dock is killed:
#!/bin/sh
sleep 1 && killall Dock &
exit 0