Removing or Purging the "Waiting Room"

rob_potvin
Contributor III

If I delete the "Waiting Room" folder and then do an inventory will all those cached packages be gone?

Some clients have come back online and have a bunch of old cached packages and we need to just start over, re-cache so to speak and then install.

This is what I am planning to do... feedback?

if [ -e /Library/Application Support/JAMF/Waiting Room/ ]
    then
        echo "Removing cached packages"
        ${RM} -rf /Library/Application Support/JAMF/Waiting Room/
    else
        echo "Files Already Removed"
fi
19 REPLIES 19

mm2270
Legendary Contributor III

We have something similar that runs periodically in case anything just gets "stuck" in that folder. Does no harm as far as I can tell. Only difference with ours is, we just remove the contents of the folder not the folder itself. It has the same effect.

rob_potvin
Contributor III

Yeah I thought of that but found that the "Waiting Room" was created again when something was cached so I just did it that way..

Okay so it works then eh?

stevewood
Honored Contributor II
Honored Contributor II

Only question I'd have is when are you planning on running this? You mentioned that you have machines that have come back online, how are you planning on running this against those machines?

I do something similar, but only for when I am caching a new version of a package just to make sure there isn't an old version of the same package out there. This is especially true here when deploying new CS versions (CS4 to CS5.5, etc).

I'm assuming you would run this manually, or use a Smart Group to catch machines that have not checked in for X number of days. Scope a policy to that SG and have this script run as part of the policy.

jwojda
Valued Contributor II

this errors out ...

Running script Removed Cached Packages... Script exit code: 127 Script result: Removing cached packages /Library/Application Support/JAMF/tmp/Removed Cached Packages: line 4: -rf: command not found Running Recon... Retrieving inventory preferences

mm2270
Legendary Contributor III

@jwojda - I never noticed it back when I posted on this thread, but if you're using Rob's script as is, he has a variable in place of the rm command on the 4th line. I assume he was defining the path to rm in his script elsewhere and what's above was only a snippet.
Anyway, replace "${RM}" with just "rm" (no quotes) and it should work. His example above also does not have the necessary shebang as its first line, so add that as well.

ctangora
Contributor II

We have multiple smart groups setup so we can cache to different segments at different times. This has led to us using two smart groups to remove cached installers.

1) Over-Cached checks version of App installed (or app missing) and version cached. Removes cached file if it falls in this smart group.
2) Old Cache, all old cached versions go in here, and will be removed.

We remove it with just a simple command, run from the Advanced Menu.

rm -fdrv /Library/Application Support/JAMF/Waiting Room/*AppName* 2>/dev/null

jhalvorson
Valued Contributor

Use this as a template as an example for deleting a list of specific cached files. In this example, I needed to delete the name of several cached 10.9 installers. Silly me, I kept changing the name of the package so there are three possible names along with the three files associated that end in ".cache.xml".

#!/bin/sh

# This script will delete a list of known JAMF cached files.  The script will
# detect to see if a file exists first, and if the file does exist, 
# it will be deleted.


files=( '/Library/Application Support/JAMF/Waiting Room/SelfService_Install_OSX_Mavericks(13c64).dmg' '/Library/Application Support/JAMF/Waiting Room/SelfService_Install_OSX_Mavericks(13c64).dmg.cache.xml' '/Library/Application Support/JAMF/Waiting Room/Install OS X Mavericks.InstallESD.dmg' '/Library/Application Support/JAMF/Waiting Room/Install OS X Mavericks.InstallESD.dmg.cache.xml' '/Library/Application Support/JAMF/Waiting Room/Install_OS_X_Mavericks.dmg' '/Library/Application Support/JAMF/Waiting Room/Install_OS_X_Mavericks.dmg.cache.xml' )

# Note:  In the paths above, the spaces and other special characters should not 
#       have a  (backslash) - remember to clean up those if you copy and paste 
#       the path from a terminal window.

# Loop through the files included in the array and delete the files 
#       if they are found

logger "BEGIN  Script to clean up some Casper Suite cached files."

for (( i = 0; i < ${#files[@]} ; i++ ))
do
    myFile="${files[$i]}"
    if [ -e "$myFile" ]
        then
            logger "Deleted: $myFile"
            rm -rf "$myFile"
        else
            logger "I could not delete what does not exist:  $myFile"
    fi
done

logger "END  Clean up completed."

exit 0

ctangora
Contributor II

Why not just wipe anything that says "Install" and "OS" and "Mavericks" in the file name?
Seems like you could get it done with just the run command instead of needing to create a script for it.

#!/bin/sh
rm -fdrv /Library/Application Support/JAMF/Waiting Room/*Install*OS*Mavericks* 2>/dev/null

jhalvorson
Valued Contributor

@ctangora, thanks for the idea. I am frightened by wildcards when it comes to deleting. But it is worth testing out with other tasks I have to put together.

rob_potvin
Contributor III

@jwojda sorry about that!! @mm2270 was right, it was just an if statement of the whole "house keeping script" :)

I hope that you got what you needed working!

bentoms
Esteemed Contributor
Esteemed Contributor

I guess we could use an "Uninstall From Cached" option.

This would allow you to automate the removal with 1 policy caching until a certain date, & another uninstalling the cached item after the date has passed.

bentoms
Esteemed Contributor
Esteemed Contributor

charliwest
Contributor II

Is there $ for pkg name or something? I would really like to have the ability to remove a cached package before caching a newer release of the software, for example thunderbird seems to be releasing at a high rate, a package gets cached, before the user logs out and it gets installed there is already a newer version. I would like to cache the new package and remove the already cached one.

bbot
Contributor

+1. I could also benefit from having a "delete cached packages" button. Running into the same issue with Microsoft Updates that seem to come out every 2-4 weeks.

jhalvorson
Valued Contributor

Here's the script I use to purge all installers that have been cached to the client.

#!/bin/sh

# Sometimes the cached packages stored in the JAMF Waiting Room folder are old or should be removed.
# This script will delete the entire folder.  The Waiting Room folder will reappear if a package or script is set to be cached to the computer.

if [ -e /Library/Application Support/JAMF/Waiting Room/ ]
    then
        echo "Removing cached packages"
        rm -rf /Library/Application Support/JAMF/Waiting Room/
    else
        echo "The waiting room folder wasn't there.  No cached files to delete."
fi

dvasquez
Contributor III

I ended up needing to remove a single package while keeping the "Waiting Room" directory the script @jhalvorson posted worked very well for me.

I wanted to say thank you.

Kallendal
New Contributor III

--

dugnl
New Contributor III

jhalvorson's specific list script from 2014 worked for me to remove a 20GB Adobe CC package. Thank you

brain_epsilon
New Contributor II

So, I'm no scripting wizard but would something like this work?

I'm trying to create a script that its as non-distructive as possible, targeting specific files. So using $4 would allow me to have the full name of the package that I'm trying to remove?

#!/bin/sh

# This script will delete a list of known JAMF cached files.  The script will
# detect to see if a file exists first, and if the file does exist, 
# it will be deleted.


files=( '/Library/Application Support/JAMF/Waiting Room/$4' )

# Note:  In the paths above, the spaces and other special characters should not 
#       have a  (backslash) - remember to clean up those if you copy and paste 
#       the path from a terminal window.

# Loop through the files included in the array and delete the files 
#       if they are found

logger "BEGIN  Script to clean up some Casper Suite cached files."

for (( i = 0; i < ${#files[@]} ; i++ ))
do
    myFile="${files[$i]}"
    if [ -e "$myFile" ]
        then
            logger "Deleted: $myFile"
            rm -rf "$myFile"
        else
            logger "I could not delete what does not exist:  $myFile"
    fi
done

logger "END  Clean up completed."

exit 0