Combine logCollection and MakeMeAnAdmin Script

addevall
New Contributor

I'm trying to combine these two scrips so a log is pulled when the user runs the MakeMeAnAdmin Script.

I will be using logCollection to pull the logs and store them into Jamf.

Currently, the script is set to give the user administrator rights for 30 minutes, then remove their access. I need the logs to be pulled after those 30 minutes are up, and not during. I just need some help brainstorming the best way to automate this in Jamf.

My initial thoughts is running a delayed script like this:

 

## Value in seconds for the script to wait before checking again
SLEEP_SECS="600"


## Loop every 600 seconds until the logged in user is not an administrator
until [[XXX ]]; do
echo "Waiting $SLEEP_SECS seconds for the user to no longer be administrator"
sleep $SLEEP_SECS
done

## Once we exit the loop, the user is no longer admin
echo "User is no longer admin...continuing script"

(still working on building to pull the current user and see if they are admin). Just not sure if this is the best way to do this, or if there's a lot simpler way to take care of this.

 

1 REPLY 1

ljcacioppo
Contributor III
Contributor III

Not sure how often your users would be elevating themselves to be administrators, but storing a bunch of log files in computer inventory records can really clutter your JAMF Pro database