-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uploading script to fix ByHost files and flush caches.
This script is designed for use as part of a Casper policy to perform the following actions: * Fix the ByHost files for the current boot drive * Flush caches from ~/Library/Caches/, ~/.jpi_cache/, and the Microsoft Office font cache for the logged-in user * Flush caches from /Library/Caches/ and /System/Library/Caches/, except for any com.apple.LaunchServices caches
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...on_scripts/Casper_Scripts/fix_byhost_and_flush_user_and_system_caches/README.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This script is designed for use as part of a Casper policy to perform the following actions: | ||
|
||
* Fix the ByHost files for the current boot drive | ||
* Flush caches from ~/Library/Caches/, ~/.jpi_cache/, and the Microsoft Office font cache for the logged-in user | ||
* Flush caches from /Library/Caches/ and /System/Library/Caches/, except for any com.apple.LaunchServices caches |
40 changes: 40 additions & 0 deletions
40
...ix_byhost_and_flush_user_and_system_caches/fix_byhost_and_flush_user_and_system_caches.sh
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# This script performs the following actions: | ||
# | ||
# Fix the ByHost files for the logged-in user | ||
# Flush caches from ~/Library/Caches/, ~/.jpi_cache/, and the Microsoft Office font cache for the logged-in user | ||
# Flush caches from /Library/Caches/ and /System/Library/Caches/, except for any com.apple.LaunchServices caches | ||
# | ||
|
||
CheckBinary (){ | ||
|
||
# Identify location of jamf binary. | ||
|
||
jamf_binary=`/usr/bin/which jamf` | ||
|
||
if [[ "$jamf_binary" == "" ]] && [[ -e "/usr/sbin/jamf" ]] && [[ ! -e "/usr/local/bin/jamf" ]]; then | ||
jamf_binary="/usr/sbin/jamf" | ||
elif [[ "$jamf_binary" == "" ]] && [[ ! -e "/usr/sbin/jamf" ]] && [[ -e "/usr/local/bin/jamf" ]]; then | ||
jamf_binary="/usr/local/bin/jamf" | ||
elif [[ "$jamf_binary" == "" ]] && [[ -e "/usr/sbin/jamf" ]] && [[ -e "/usr/local/bin/jamf" ]]; then | ||
jamf_binary="/usr/local/bin/jamf" | ||
fi | ||
} | ||
|
||
# Run the CheckBinary function to identify the location | ||
# of the jamf binary for the jamf_binary variable. | ||
|
||
CheckBinary | ||
|
||
# Fixes the ByHost files for the current boot drive | ||
|
||
$jamf_binary fixByHostFiles -target / | ||
|
||
# Flush caches in the logged-in user's home directory | ||
|
||
$jamf_binary flushCaches -flushUsers | ||
|
||
# Flush OS system caches | ||
|
||
$jamf_binary flushCaches -flushSystem |