I found a "product issue". If I run a script with Jamf Pro 10 with an exit code 1 the policy will have a failed status.
#!/bin/sh exit 1
I f I run the same script with the Files and Processes > Execute Command option it will not recognise the exit output. For example
Any idea for a workaround?
Solved! Go to Solution.
It depends on what you are trying to do.
You could always have a JAMF script call the local script and parse the results back to the JSS.
If you just after machines where script has had issues you could have it output to a file and build an extension attribute around that (some delay here, although not if there was an inventory update in the same policy).
Is there a reason for running a script locally and not from the JSS, I try to avoid local scripts unless completely necessary.
@Look We are running multiple Jamf Pro servers (at the moment 165 and growing) where we deploy a script locally. This script is used by multiple policies (on average 30) on each server. We don't want to create a script on the JSS for each policy otherwise there is too much maintenance to be done. Just a policy with the "Files and Processes" option.
You wouldn't need to create the exact script itself on each server, just another script that will run the local one and capture it's exit code and use that exit code for it's own exit status, if necessary.
I did a few tests, and I don't see a way for Files and Processes to capture the exit code of a local script being run. It just doesn't seem possible, but that doesn't mean there is absolutely not some way to do it. I would at least try creating a new JSS script that would run the local one and see if that works. It might be your only option.