Is there a variable or something that can be used in a script to show which trigger launched the script?
Hmm? Can you explain what you mean by 'which trigger'? Are you talking about the policy triggers, like Recurring Check-in, Login, Logout, etc? Or do you mean something else?
If I have a script that has two triggers, Recurring Check-In and Network State Change, I'd like to see which trigger caused the script to launch. That way I can have the script do different things depending on the trigger without having to have multiple scripts and policies.
You could parse the end of the jamf.log maybe, but that is not something the script is aware of normally.
OK, I thought that's what you meant. So, the script is a payload in a policy that can be called by 2 or more different triggers. What you're asking then is how to make the script know which trigger called the owning policy for the script itself.
Its a good question. I'm not certain there's a built in way. I don't think so. But there may be some way of knowing. I'd have to give that some thought.
Thanks for the help guys. If something comes to mind, let me know. Until then, I'll put in a feature request.
I thought of parsing the end of the jamf log myself at first, but I doubt that would be highly accurate. Might get lucky a number of times, but you're bound to run into cases where it won't get you the info you're looking for.
One thing that MIGHT kind of work... Check the $3 variable for a valid username.
It would take some testing to confirm but I think if it's only populated if it was called by login or self service, so if it's not then it was some other type of trigger.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.