Posted on 10-31-2014 08:11 AM
Hi all,
So I'm working on a policy to run when no user is logged into their machine. We run 24 hours here and desks are randomly filled. I have the logic of determining if a user is logged in or not already handled via a shell script. What I need, is some way to determine if a script should run or not depending on the result of the script *in real time*. I can run this as an extension attribute, but those only update at specific intervals. Smart groups are also dependent on the recon. I was thinking about doing this via a cron or something else outside of JSS, but I'd prefer to keep it inside the JSS and it's framework if at all possible. Any suggestions? Perhaps a feature set I'm overlooking or somewhere where somebody has already done something similar?
Solved! Go to Solution.
Posted on 10-31-2014 08:16 AM
You could set a custom trigger on the policy and then set a script to run as another 'ongoing' policy. This would evaluate the script each checkin, and then that script could be set to run 'jamf policy -event <customEvent>' based on the results.
Posted on 10-31-2014 08:17 AM
Script to determine if current user is root, if so trigger a policy. Might want to toss up a dialog box if you do this.
[EDIT: Sorry @bvrooman looks like I posted a second after you did!]
Posted on 10-31-2014 08:22 AM
Create a policy with a custom trigger and call it from your script with
jamf policy -trigger yourcustomtrigger
or
jamf policy -event yourcustomtrigger
, both should work
Posted on 10-31-2014 08:16 AM
You could set a custom trigger on the policy and then set a script to run as another 'ongoing' policy. This would evaluate the script each checkin, and then that script could be set to run 'jamf policy -event <customEvent>' based on the results.
Posted on 10-31-2014 08:17 AM
Script to determine if current user is root, if so trigger a policy. Might want to toss up a dialog box if you do this.
[EDIT: Sorry @bvrooman looks like I posted a second after you did!]
Posted on 10-31-2014 08:22 AM
Create a policy with a custom trigger and call it from your script with
jamf policy -trigger yourcustomtrigger
or
jamf policy -event yourcustomtrigger
, both should work
Posted on 11-03-2014 06:18 AM
All responses were great.