Having issues with several packages, in particular Acrobat where users never seem to quit out. Working on a script to check for running app, upgrade if NOT running, present user with a notification if it is.
Have basic syntax down, but still running into issues. Anyone want to chime in on it and tell me what I'm missing? Have snippets taken from some of my other scripts and some from scripts found here on JamfNation, but missing something when sticking it all in together.
Basically, I'm caching the installer on all machines with a separate policy. Using a smart group detecting the cached installer, I then run the following script. It first checks to see if Acrobat is running. If NOT, proceeds to call a policy to install the cached package. If Acrobat IS running, asks user to save and quit (and run package) or allows them to cancel and it will simply repeat at the next policy check-in interval.
#!/bin/sh
#shorten path for JAMFHelper to abreviate following lines
JAMFHELPER="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"
#determine if Acrobat is running:
IsAcrobatRunning=$(pgrep -l "Acrobat" | cut -c6-30)
if [ "$IsAcrobatRunning" = "AdobeAcrobat" ] ; then
echo "Detected running Acrobat instance, prompting user to quit and upgrade"
# Get the user's selection
RESULT=$JAMFHELPER -windowType hud -title Updates Required -heading Adobe Acrobat -description "There is a pending Adobe Acrobat security update. Please quit out of Acrobat now, as the installation of this software will fail if it detects a Acrobat running during the installation. Click OK to indicate that Acrobat has been quit and to upgrade now, Cancel will re-try in one hour. Thank you for your patience while we upgrade." -icon /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertNoteIcon.icns -button1 "Cancel" -button2 "OK")
echo "jamf helper result was $RESULT";
if [ "$RESULT" == "0" ]; then
echo "Clicked OK, time to quit Acrobat!"
/usr/sbin/jamf policy -trigger InstallCachedAcrobat
exit 0
else
echo "user chose Cancel";
exit 1
fi
echo "Acrobat is not running, proceeding with upgrade"
/usr/sbin/jamf policy -trigger InstallCachedAcrobat
exit 0