Posted on 06-26-2024 02:11 PM
I'm working on a new post install script for Nudge. Delivering Nudge settings using a profile has not been as reliable as I would like it to be. I found Dan Snelson's Nudge post install script (https://github.com/dan-snelson/Nudge-Post-install/wiki) and it has been a good starting point. Its command to load the launch agent doesn't work. My understanding is that we need to use Launchctl bootstrap instead of Launchctl load as we did with older versions of macOS. I have other scripts that load launch daemons that use bootstrap/bootout. These work well. Since a launch agent loads when a user logs in, it's different. What is the proper command to load a launch agent using a script deployed by Jamf Pro? If I can get this one thing to work, it pretty much wraps up getting this done.
Solved! Go to Solution.
Posted on 06-27-2024 03:55 AM
For LaunchAgents, I'm always using the following pattern:
#!/bin/bash
Name_loggedInUser=$(stat -f %Su /dev/console)
UID_loggedInUser=$(id -u $Name_loggedInUser)
launchctl bootstrap gui/$UID_loggedInUser <path to LaunchAgent plist>
Posted on 06-27-2024 03:55 AM
For LaunchAgents, I'm always using the following pattern:
#!/bin/bash
Name_loggedInUser=$(stat -f %Su /dev/console)
UID_loggedInUser=$(id -u $Name_loggedInUser)
launchctl bootstrap gui/$UID_loggedInUser <path to LaunchAgent plist>