Last active
November 20, 2021 20:44
-
-
Save macmule/4a1a3f9eb614bf3c7c36b079c7db856a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| #################################################################################################### | |
| # | |
| # License: https://macmule.com/license/ | |
| # | |
| #################################################################################################### | |
| # HARDCODED VALUES ARE SET HERE | |
| # Volume Reserve Percent | |
| reservePercent="" | |
| # CHECK TO SEE IF A VALUE WAS PASSED IN PARAMETER 4 AND, IF SO, ASSIGN TO "claunchAgentHour" | |
| if [ "$4" != "" ] && [ "$reservePercent" == "" ];then | |
| reservePercent=$4 | |
| fi | |
| #################################################################################################### | |
| # Error if either variable $4 is empty | |
| if [ "$reservePercent" == "" ]; then | |
| echo "Error: No value was specified for the reservePercent variable..." | |
| exit 1 | |
| fi | |
| #################################################################################################### | |
| # Unload com.apple.swupdate.sync.plist | |
| sudo launchctl unload -w /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.swupdate.host.plist | |
| echo "Unloaded /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.swupdate.host.plist..." | |
| # Change the Volume Reserve Percent | |
| sudo defaults write /Library/Server/Software\ Update/Config/swupd/swupd.plist systemVolumeReserve -int $reservePercent | |
| echo "Set systemVolumeReserve value to $reservePercent%..." | |
| sudo chown root:_softwareupdate /Library/Server/Software\ Update/Config/swupd/swupd.plist | |
| sudo chmod 755 /Library/Server/Software\ Update/Config/swupd/swupd.plist | |
| echo "Corrected permissions on Library/Server/Software Update/Config/swupd.plist..." | |
| # Reload com.apple.swupdate.sync.plist | |
| sudo launchctl load -w /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.swupdate.host.plist | |
| echo "Reloaded /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.swupdate.host.plist..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment