We have a script which I'm attempting to run once a week via a launchd task. Launchd appears to be working normally, script launches, but at the end of the script it calls a JSS policy via a custom trigger. This portion of the script appears to be failing. If I run the script manually, it tells me "There was an error. This application must be run as root. Try the sudo command." Running with sudo produces the desired result.
What is the best-practice in terms of having launchd execute the script with admin/root privileges?
My launch daemon plist is in /Library/LaunchDaemons, ownership set to root:wheel, -rw-r--r--
Script itself is located in /Library/Application Support/JAMF/Scripts, and similarly, root wheel -rwxr-xr-x
It appears that the "jamf -policy -event <trigger> command in the script is where it is asking for sudo - what is the best way to make this run correctly when triggered by launchd?