recon and policy script failing

New Contributor III

Hi,we have a small script that runs during recurring check-in but it keeps failing, here is the output of the error reported in JAMF:

Executing Policy Automatic Updates recurring check weekly
Running script JAMF recon and policy...
Script exit code: 1
Script result: Retrieving inventory preferences from
Locating hard drive information...
Locating accounts...
Locating applications...
Locating package receipts...
Searching path: /System/Applications
Locating software updates...
Locating plugins...
Locating printers...
Searching path: /Library/Internet Plug-Ins
Searching path: /Applications
Locating hardware information (Mac OS X 10.15.6)...
Gathering application usage information...
Submitting data to
This policy trigger is already being run: root 17466 0.0 0.1 4390244 15208 ?? Ss 12:10AM 0:00.17 /usr/local/jamf/bin/jamf policy -randomDelaySeconds 300
Error running script: return code was 1.

Here is the script:
sudo jamf recon; sudo jamf policy

What am I missing here? Any help would be appreciated!


Valued Contributor

Try running the script on the command line on a machine and see what it says.

I think you need to give the full path to the jamf binary as root doesn't have the jamf binary in it's path. If jamf is running the script, it will be running as root so no need for sudo. To me the script should look like this:

#!/bin/bash /usr/local/bin/jamf recon /usr/local/bin/jamf policy