Script Halting Policy

rafemoody
New Contributor

Hello,

I'm hoping there is a quick and simple answer which I just haven't stumbled across yet. Currently, we have applications which we want to launch at the beginning of our enrollment policies to notify our end users about how long the installation will last. Previously we had been using Cocoa Dialog to flash a message but we would like to use Jason Tratta's ProgressScreen. The problem I am running into is that when I attempt to use a script to launch the application (or to launch CocoaDialog) all policies halt until the application is exited. This wasn't a big deal with Cocoa Dialog because the end user just hits the "OK" button. I would like to background the script so that it runs but the policy progresses. I would think there should be an easy way to do this but I haven't run across it yet. Below is the script I am using at the beginning of the enrollment policy. I do have a policy run prior which installs the package. I have also tried executing the application through a post flight script with installation policy but I am getting the same problem. Script:

!/bin/bash

cd /path/to/ProgressScreen.app/Contents/MacOS/
./ProgressScreen

Thank you for your time and pointing out which are undoubtedly beginner scripting errors.

Rafe Moody

1 ACCEPTED SOLUTION

stevewood
Honored Contributor II
Honored Contributor II

@rafemoody assuming your script is also calling the other policies that you are installing apps with, placing an ampersand behind the ./ProgressScreen line will make that command run in a background state:

#!/bin/sh
/path/to/ProgressScreen.app/Contents/MacOS/ProgressScreen &

# now do some stuff to install stuff

# at the end:
killall ProgressScreen

The killall line may or may not be needed. Typically I find that it is needed (like with jamfHelper) to clear that app so that the policy finishes.

View solution in original post

1 REPLY 1

stevewood
Honored Contributor II
Honored Contributor II

@rafemoody assuming your script is also calling the other policies that you are installing apps with, placing an ampersand behind the ./ProgressScreen line will make that command run in a background state:

#!/bin/sh
/path/to/ProgressScreen.app/Contents/MacOS/ProgressScreen &

# now do some stuff to install stuff

# at the end:
killall ProgressScreen

The killall line may or may not be needed. Typically I find that it is needed (like with jamfHelper) to clear that app so that the policy finishes.