I am putting together a simple script that will allow a user, when added to the appropriate scope, to have access to a button on self-service that will promote the user to a local admin for a preset number of minutes, Say 15 minutes. Then after the 15-minute interval expires, the script removes them from the admin group.
It works but during that 15-minute interval, the self-service icon spins the in-progress wheel.
I would prefer it to execute and have the self-service button complete, then in 15 minutes demote the user.
It is likely the command I am using to sleep for 900 seconds.
#!/bin/bash
## query the system for the current console user with the loginwindow
user=$( scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
## add that user to the admin group
dseditgroup -o edit -a $user -t user admin;
## after fifteen minutes
sleep 900;
## remove that user from admin group
dseditgroup -o edit -d $user -t user admin;