Skip to main content
Solved

Issue getting policy to run with custom trigger


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.

View original
Did this topic help you find an answer to your question?

2 replies

mpermann
Forum|alt.badge.img+22
  • Valued Contributor
  • 690 replies
  • 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
  • 3 replies
  • 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!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings