Skip to main content
Solved

Issue getting policy to run with custom trigger

  • March 14, 2016
  • 2 replies
  • 36 views

Forum|alt.badge.img+3

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

Best answer by mpermann

@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.

2 replies

mpermann
Forum|alt.badge.img+22
  • Valued Contributor
  • Answer
  • March 15, 2016

@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.


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • March 16, 2016

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!