Smart Group - "Cached Packages <not empty>?

Taylor_Armstron
Valued Contributor

Trying to test out a new approach to software pushes and cache packages. Ideally, I'd like to then have a policy that runs weekly and simply installs all cached, but since I'm putting up warnings to users, I obviously don't want to bother the user if the machine does not have any pending cached packages.

I can use the criteria "Cached Packages" and list a specific value, but is there any way to simply check to see if the Waiting Room directory is empty? Am I going to need to create another extension attribute, or is there a better approach? I tried "Cached packages <does not have> <blank> " but that doesn't seem to work.

Taking this approach would let me cache packages without having to change deadlines on each and every one of them (we tend to be a little "patch-happy" around here), and just change the deadline on the one "install cached" policy on a regular basis.

1 ACCEPTED SOLUTION

Taylor_Armstron
Valued Contributor

Thanks @mm2270 .

That didn't work, but put this in as an EA, and it worked exactly as needed:

#!/bin/sh
# Checks for presence of cached installer packages in the "Waiting Room
# /Library/Application Support/JAMF/Waiting Room
# Used for Smart-Group scoping to the Has Cached Packages-smart Smart Group

if [ "$(ls -A /Library/Application Support/JAMF/Waiting Room/)" ]; then
   echo "<result>Cached Updates Pending</result>"
else
   echo "<result>None Available</result>"
fi
exit 0

View solution in original post

2 REPLIES 2

mm2270
Legendary Contributor III

You might have to use an Extension Attribute. I can't recall now if the JSS allows for wildcards in smart group values or not. I think it used to but I don't know if that still works. For example, if say, a wildcard is just %, you could put in

Cached Packages | does not have | "%"

Not sure if % is a wildcard, I'm just using that as an example. I haven't tried it, but you could :)

Taylor_Armstron
Valued Contributor

Thanks @mm2270 .

That didn't work, but put this in as an EA, and it worked exactly as needed:

#!/bin/sh
# Checks for presence of cached installer packages in the "Waiting Room
# /Library/Application Support/JAMF/Waiting Room
# Used for Smart-Group scoping to the Has Cached Packages-smart Smart Group

if [ "$(ls -A /Library/Application Support/JAMF/Waiting Room/)" ]; then
   echo "<result>Cached Updates Pending</result>"
else
   echo "<result>None Available</result>"
fi
exit 0