Best Practices for Detecting if Cached Packages (Waiting Room) are Ready for Install

New Contributor

What do you think is the best way to trigger an install of cached packages (i.e. ones in the "JAMF/Waiting Room" directory)?

My first solution was to create a policy that installed cached packages on startup. I would like to do something that gives the user more feedback as this method has caused performance issues for larger installs. A variation of the @lisacherie script described in fits the bill, but would require detecting if there are ready items in the Waiting Room directory.

Obviously, a non-zero return of `ls /Library/Application Support/JAMF/Waiting Room/` would be some kind of solution, but is fragile for a variety of reasons. The jamf binary doesn't seem to have anything related to the package cache other than `jamf installAllCached`.

Is there a better method than checking the "Waiting Room" directory?

Is there a way to tell if items are being downloaded into the cache?

Thank you in advance.


Legendary Contributor III

I think you might do well to make an Extension Attribute that returned the number of packages that are living in the Waiting Room directory. Set it to an integer value and then you can build a Smart Group off it for any Macs with "more than 0" updates waiting, or whatever threshold you want to set.

To avoid getting false positives using something like 'ls', try the find command looking for specific extensions.


Found=$( find /Library/Application Support/JAMF/Waiting Room/ -maxdepth 1 -name *.mpkg -or -name *.pkg -or -name *.dmg | wc -l | sed 's/^[ 	]*//' )

echo "<result>$Found</result>"

That should return a value from 0 to whatever number of updates it finds there.

Edit: meant to add that I don't know of a good way to tell if packages are still currently downloading to the directory. I'm sure there are some ways though. I seem to recall from way back in the day that the OS flags files that are being copied or downloaded in some way that you may be able to tell your install script to ignore. But I can't think of what that is at the moment.

New Contributor III

Here's mine. Displays packages in 'waiting room', whether there are no packages in waiting, and whether there is no waiting room folder.


if [ -d /Library/Application Support/JAMF/Waiting Room ];then
    result=`/bin/ls -1 /Library/Application Support/JAMF/Waiting Room/ 2> /dev/null | /usr/bin/grep -v ".cache.xml"`
    if [ $result == "" ];then
        echo "<result>No packages</result>"
        echo "<result>$result</result>"
    echo "<result>No waiting room</result>"

exit 0