Skip to main content
Solved

Boot Script Help


Forum|alt.badge.img+22

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

Best answer by mm2270

If that's being run as a LaunchDaemon, you have to include the full path to the jamf binary for it to work. It has to do with the default PATH settings used with LaunchDaemons not including /usr/local/bin/ or something like that. It doesn't know what jamf resolves to, so change it to /usr/local/bin/jamf policy and it should work I think.

Though that doesn't actually explain why the softwareupdate command isn't running, I would include the full path to that as well (/usr/sbin/softwareupdate) to be on the safe side. Maybe it's also not resolving, though it should.

View original
Did this topic help you find an answer to your question?

Forum|alt.badge.img+12
  • Contributor
  • May 1, 2017

I ran into this also as the jamf policy check never ran. It'a as though it just skips this. I also manually added a policy check to the jamf startup script and the login script (/Library/Application Support/JAMF/ManagementFrameworkScripts/) but the policy call only kicked off on the loginhook.sh.

I haven't been back to test it out but is the jamf binary not actually running yet when the launchAgent and script kick off?


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • May 1, 2017

If that's being run as a LaunchDaemon, you have to include the full path to the jamf binary for it to work. It has to do with the default PATH settings used with LaunchDaemons not including /usr/local/bin/ or something like that. It doesn't know what jamf resolves to, so change it to /usr/local/bin/jamf policy and it should work I think.

Though that doesn't actually explain why the softwareupdate command isn't running, I would include the full path to that as well (/usr/sbin/softwareupdate) to be on the safe side. Maybe it's also not resolving, though it should.


Forum|alt.badge.img+22
  • Honored Contributor
  • May 2, 2017

@mm2270 Updated the script and tested overnight. Changing to the full path worked like a charm, thanks very much for the help!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings