Issue getting policy to run with custom trigger

Meesterroboto
New Contributor

I am very new to using JSS and am trying to run a policy by using a script in another policy.

The idea is to have a policy run a script every day that checks for certain parameters. If it finds what it is looking for, it triggers another policy, via custom event, and that policy runs a script that does what I need.

Both script's logic is working with one exception: when trying to trigger the second policy with the script, I get an error. I have trouble shot it down to a single line of code and am unsure how to proceed.

#!/bin/sh

sudo jam policy -event nameOfCustomEvent

If I comment out that line, I have zero issues. Obviously I am unable to run the second policy when doing so. I am using self service to run the policies manually for testing. "The error I get in self service reads: There was a problem installing nameOfPolicy. Contact your administrator." No other information is given.

Any thoughts

1 ACCEPTED SOLUTION

mpermann
Valued Contributor II

@Meesterroboto You shouldn't need the sudo in the command. Also, the command should be

#!/bin/sh
jamf policy -event nameOfCustomEvent

I'm not sure if the typo is only here on JAMF Nation or also extends to your actual script.

View solution in original post

2 REPLIES 2

mpermann
Valued Contributor II

@Meesterroboto You shouldn't need the sudo in the command. Also, the command should be

#!/bin/sh
jamf policy -event nameOfCustomEvent

I'm not sure if the typo is only here on JAMF Nation or also extends to your actual script.

Meesterroboto
New Contributor

Woops! That did the trick.

I was looking at another support community discussion (from 2012) regarding custom triggers and they had the typo in the sample code they provided. I had no idea!

Removed sudo and fixed the typo and now everything works as expected!

Thanks!