Skipping it."ĭone < <(ls "/Library/Application Support/JAMF/Waiting Room/")Įcho "No Waiting Room directory, so no cached packages"Įdit: Changed the rm line to account for both flat files and bundle packages. Rm -Rfd "/Library/Application Support/JAMF/Waiting Room/$cache"Įcho "The cache file is not a previous version.
#!/bin/bashĬurrPolicyName=$(awk -F'Policy ' '/Executing Policy/." Test, test and do more testing, since this is deleting items. Its a little dangerous though since, if you're not careful how you name stuff, you could end up matching other valid caches and deleting those as well.īut give this a try.
Since the jamf.log will have the policy name in it as it runs, if we grab the running policy name and do a partial string match on any cached items using that, we can target the correct packages to rm from the folder and potentially leave any others. If so, you could try something like this as a Before script. For example, using your Skype example above, if the policy name has the word Skype in it somewhere, like "Install Skype" or "Skype 6.19.0.442" and the packages all have the term "Skype" or "skype" in them, like with your example. The only way you could semi automate this would involve making absolutely certain your policy names have the same (partial) string in them as the package names AND also that your packages have the name of the application in them that would match something in the policy name. Additionally, you can specify one or more packages that you want to clean. It will be populated again the next time yarn or yarn install is run.
yarn cache cleanOr something like what nessts posted above. Running yarn cache dir will print out the path where yarn’s global cache is currently stored. Using a script as you posted above is going to be the most reliable way to do this.