We help top organizations stay competitive, by implementing the latest disruptive technologies.

Latest Posts
 

Recover Hard Drive Space by Purging the LANDESK SDCache Folder

Recover Hard Drive Space by Purging the LANDESK SDCache Folder

Whenever a Mac is told to perform a software distribution or patch task, the LANDESK agent will download the binaries for that task and store them in the sdcache folder found under /Library/Application Support/LANDesk. By default, the LANDESK agent will purge any file older than 45 days, so in most scenarios, there is little need to pay attention to what is in that folder.

full-sdcache

However, if you find that your Mac is short on hard drive space, perhaps due to the GB’s worth of patch binaries that were placed on it after having recently updated to the 64-bit version of Microsoft Office, you might find the little purgeSDCache.sh script available on my GitHub site or pasted below a beneficial tool to have in ready in your arsenal of LANDESK packages.

#!/bin/sh

# purgeSDCache.sh
# Created by Bennett Norton on 9/16/16.
# This script will delete all non-standard files/folders from the LANDESK sdcache folder
# Change the path variables


#Script Variables
#change these variables to match your token and desired destination paths
landeskPath="/Library/Application Support/LANDesk/sdcache"


#Check to see if destination path exists and if it does, delete the files older than x number of days old
#The +10 after the -mtime switch tells the command to delete everything older than 10 days. You can adjust that number.
if [ -d "$landeskPath" ]; then
 echo "LANDESK Agent present, deleting and recreating the sdcache folder. "
 find "$landeskPath"/* -mtime +10 -exec rm -rf {} \;
fi

So what does this script do?  It is quite simple really, the script does a search inside the SDCache folder and deletes any and all files older than “10 days.” You can easily adjust age of the files to keep and there is no reason you can’t set that value to 0 days and essentially purge everything.  Just adjust the number after the -mtime switch to whatever suites you.

Now you just have to create the package and deploy to the machines that are short on hard drive space.  Just remember to set the execute permissions on your script prior to copying it to your file share.  You do that by opening Terminal and running the command below:

sudo chmod +x /path/to/script.sh

Creating LANDESK Management Suite Mac Packages

  1. Open the LANDESK Console
  2. Navigate to the top menu bar, select Tools > Distribution > Distribution Packages.
  3. In the lower left menu tree, highlight My Packages or Public Packages from within the Distribution Packages window
  4. On the Distribution menu bar, press the New Package button and select New Macintosh Package.
  5. Give the package a name
  6. Provide a description as well as any metadata information desired
  7. Set the primary file to the script file you previously transferred to your package share
  8. Fill out the Metadata details if desired, specifically supplying a logo so it shows up properly in the portal
  9. Save the package

Creating a Scheduled Mac Software Distribution Task

  1. Right click on the Mac software distribution package created and select Create Scheduled Task
  2. From the network view, select and drag the desired machine(s), user(s) or query(ies) and drop them onto the task
  3. Now, right click on the task and select properties
  4. Set the desired Task type under Task Settings as to whether you want a push, a policy or a hybrid of the two types in a policy-supported push
  5. Set the radio button in the Portal Settings to either Recommended or Optional if you desire to put the package into Workspaces.  If you’d like to automatically deploy the app, select Run automatically
  6. Change the Reboot Settings or Distribution and Patch settings if desired
  7. Set the schedule task settings with the appropriate start time
2 Comments

Post A Comment