Script help: Delay calling custom trigger?

Taylor_Armstron
Valued Contributor

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 3

mm2270
Legendary Contributor III

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?

Taylor_Armstron
Valued Contributor

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
Legendary Contributor III

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.