weldon
11/16/2018 - 7:28 PM

Holmes' 256gb drive content caching script

Holmes' 256gb drive content caching script

#!/bin/bash

sudo /usr/bin/AssetCacheManagerUtil deactivate

#For example, to set the Interface key to en1, execute this command as an #administrator:
#sudo -u _assetcache defaults write /Library/Preferences/com.apple.AssetCache.plist Interface -string en0


# The maximum number of bytes of disk space that will be used to cache assets.
# If you need help converting Gigabytes to Bytes you can use a site like this: http://whatsabyte.com/P1/byteconverter.htm

#The maximum number of bytes of disk space that will be used for the content cache.
#You can also set this value in Content Caching preferences
sudo defaults write /Library/Preferences/com.apple.AssetCache.plist CacheLimit -int 187904819200


sudo defaults write /Library/Preferences/com.apple.AssetCache.plist ReservedVolumeSpace -int 53687091200

#Allow the caching of users’ iCloud data. At least one of the AllowPersonalCaching or AllowSharedCaching keys must be yes.

sudo defaults write /Library/Preferences/com.apple.AssetCache.plist AllowSharedCaching true

#AllowPersonalCaching Description:
#You can also set this value in Content Caching preferences.
sudo defaults write /Library/Preferences/com.apple.AssetCache.plist AllowPersonalCaching false

#LogClientIdentity Description:
#After using the defaults command, be sure to run the following command to reload #the content cache settings:
#sudo -u _assetcache defaults write /Library/Preferences/com.apple.AssetCache.plist ListenRanges '( { first = 10.0.0.1; last = 10.0.0.254; }, { first = 10.1.0.1; last = 10.1.0.254; } )'
#LogClientIdentity = yes



#MaxConcurrentClients Description:
#This limit is to prevent content caching from running out of file descriptors. #Apple does not guarantee that a content cache can achieve 3400 concurrent #clients.

sudo defaults write /Library/Preferences/com.apple.AssetCache.plist MaxConcurrentClients 3400

# Parents Description
#A list of the local IP addresses of other content caches from which this cache #should download or upload content instead of downloading from or uploading to #Apple directly.
#Parents


#ParentSelectionPolicy Description: 
#The policy to use when choosing among more than one configured parent content cache.
#With every policy, parent caches that are temporarily unavailable are skipped.
#ParentSelectionPolicy first-available


sudo /usr/bin/AssetCacheManagerUtil activate

#AssetCacheManagerUtil reloadSettings Descriptions: 
#After using the defaults command, be sure to run the following command to reload #the content cache settings:
sudo AssetCacheManagerUtil reloadSettings


#"$scutil --get ComputerName" = $foldername

#These three commands will will output information into a report on each #desktop. 

#Find out whether content caching is on.
#sudo AssetCacheManagerUtil isActivated >> ~/Desktop/$HOSTNAME/

#Display content cache status.
#echo AssetCacheManagerUtil status > ~/Desktop/cache.txt

#Display content cache settings.
#sudo  AssetCacheManagerUtil settings