From c0fe57f6486480e60a8ee968ea8f38bd63d0d5c7 Mon Sep 17 00:00:00 2001 From: Andrew Pirkl Date: Mon, 4 May 2020 16:07:26 -0500 Subject: [PATCH 1/3] Update execution order Changed execution order to fix daemon stopping before the script was finished which stopped execution of the script Updated comment on line 38 to reflect correct run interval time --- MakeMeAnAdmin.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MakeMeAnAdmin.sh b/MakeMeAnAdmin.sh index 5c2a54f..de98c99 100644 --- a/MakeMeAnAdmin.sh +++ b/MakeMeAnAdmin.sh @@ -35,7 +35,7 @@ sudo defaults write /Library/LaunchDaemons/removeAdmin.plist Label -string "remo #Add program argument to have it run the update script sudo defaults write /Library/LaunchDaemons/removeAdmin.plist ProgramArguments -array -string /bin/sh -string "/Library/Application Support/JAMF/removeAdminRights.sh" -#Set the run inverval to run every 7 days +#Set the run inverval 30 minutes sudo defaults write /Library/LaunchDaemons/removeAdmin.plist StartInterval -integer 1800 #Set run at load @@ -81,6 +81,7 @@ if [[ -f /private/var/userToRemove/user ]]; then launchctl unload /Library/LaunchDaemons/removeAdmin.plist rm /Library/LaunchDaemons/removeAdmin.plist log collect --last 30m --output /private/var/userToRemove/$userToRemove.logarchive + launchctl remove removeAdmin fi EOF From 625c1b95535bd1b79c7be2b3d33833b808fa1828 Mon Sep 17 00:00:00 2001 From: Andrew Pirkl Date: Mon, 4 May 2020 16:11:54 -0500 Subject: [PATCH 2/3] remove launchctl unload Remove additional unload I missed like a dummy --- MakeMeAnAdmin.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/MakeMeAnAdmin.sh b/MakeMeAnAdmin.sh index de98c99..0851045 100644 --- a/MakeMeAnAdmin.sh +++ b/MakeMeAnAdmin.sh @@ -78,7 +78,6 @@ if [[ -f /private/var/userToRemove/user ]]; then echo "Removing $userToRemove's admin privileges" /usr/sbin/dseditgroup -o edit -d $userToRemove -t user admin rm -f /private/var/userToRemove/user - launchctl unload /Library/LaunchDaemons/removeAdmin.plist rm /Library/LaunchDaemons/removeAdmin.plist log collect --last 30m --output /private/var/userToRemove/$userToRemove.logarchive launchctl remove removeAdmin From 5d1e6236704ff4126e72a45df1f794ff10098d8b Mon Sep 17 00:00:00 2001 From: Andrew Pirkl Date: Mon, 4 May 2020 16:16:49 -0500 Subject: [PATCH 3/3] fix spelling errors --- MakeMeAnAdmin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MakeMeAnAdmin.sh b/MakeMeAnAdmin.sh index 0851045..cb45678 100644 --- a/MakeMeAnAdmin.sh +++ b/MakeMeAnAdmin.sh @@ -35,7 +35,7 @@ sudo defaults write /Library/LaunchDaemons/removeAdmin.plist Label -string "remo #Add program argument to have it run the update script sudo defaults write /Library/LaunchDaemons/removeAdmin.plist ProgramArguments -array -string /bin/sh -string "/Library/Application Support/JAMF/removeAdminRights.sh" -#Set the run inverval 30 minutes +#Set the run interval to 30 minutes sudo defaults write /Library/LaunchDaemons/removeAdmin.plist StartInterval -integer 1800 #Set run at load