I have a launch daemon and a script created to run after an OS upgrade. Results are that the daemon runs, and the script but only part of the script is executing. Below is a part of the script, the Turn SSH on piece works as I can verify that in the System preferences, when the script completes it removes the daemon and self destructs, but for some reason jamf policy isn't checking for and running the policies and ASU isn't running. I have the daemon and script in in place to set some preferences, run jamf policy and run ASU on first boot after an OS upgrade we have in Self Service. Any advice?
#!/bin/bash
# Turn SSH on
/usr/sbin/systemsetup -setremotelogin on
#Check for jamf policies
jamf policy
#Run Apple Software Update
softwareupdate -i -a
# Remove setup LaunchDaemon item
/bin/rm -rf /Library/LaunchDaemons/org.name.post_os_upgrade.plist
# Make script self-destruct
/bin/rm -rf $0