mpanighetti / install-or-defer

A framework for prompting users of Jamf Pro-managed Macs to install Apple software updates.
Apache License 2.0
147 stars 28 forks source link

unload LaunchD doesn't finish script? #28

Closed master-vodawagner closed 5 years ago

master-vodawagner commented 5 years ago

Not sure if I'm being stupid here but when I test the script and get to this section on lines 264-279

Ends script without applying any system updates.

exit_without_updating () {

echo "Running jamf recon..."
"$JAMF_BINARY" recon

clean_up

if [[ -e "/private/tmp/$BUNDLE_ID.plist" ]]; then
  "/bin/echo" "Unloading $BUNDLE_ID LaunchDaemon..."
  "/bin/launchctl" unload -w "/private/tmp/$BUNDLE_ID.plist"
fi
"/bin/echo" "Script will end here."
exit 0

}

I get the "Unloading" echo prompt but never the "Script will end here" prompt. Is this because daemon running the script is unloaded so cannot finish off lines 275-279?

homebysix commented 5 years ago

Yes, I believe it's actually the launchctl unload that kills off the script. The echo and exit are just in case (and could very well be removed, but cause no harm as is).