Skip to main content
Question

Script help: Delay calling custom trigger?


Forum|alt.badge.img+15

Have a script that I'm going to push out to all machines.

At the end of the script, it calls a custom trigger to run a policy from the JSS. I'm using JamfHelper to pop up a notification for the users, with a 5 minute count down. At the end of the countdown, I want to basically run the "sudo jamf -policy -event <trigger>".

Basically, I'm trying to pass a value (in $4) for a delay before running the trigger. Any advice on the best approach?

3 replies

mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • 7881 replies
  • August 29, 2017

Just define a variable in the script that gets populated by $4, make sure in your script that you check to make sure $4 actually had a value passed to it so you aren't passing a blank value to jamfHelper. Then in the line where jamfHelper is called, replace the countdown value (or whatever it is you are using) with the variable from above instead of an integer.

That should make the jamfHelper window do a countdown based on the value passed to $4 instead of something hardcoded in.

One recommendation I would make is to actually hardcode in a value that the script can use as a default setting, in case you forget to or choose to pass something to the script.

Make sense?


Forum|alt.badge.img+15
  • Author
  • Valued Contributor
  • 382 replies
  • September 5, 2017

Thanks @mm2270 .... makes perfect sense. Just didn't realize that the script would pause until the JamfHelper countdown concluded - sounds like that should work just the way I want.


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • 7881 replies
  • September 5, 2017

Yeah, as long as you don't push the process to the background by adding a & at the end of the jamfHelper line, the script will pause and wait for that to exit before moving on to the next step.


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