Trying to run another policy while JamfHelper counts down

GabeShack
Valued Contributor III

Hey All

I am looking to have a policy get called while I have a JamfHelper window up doing a 12minute countdown.

 

This is all happening once a machine is enrolled  and keeps the techs from clicking ahead before the installs of all the software are complete.  So far I'm able to get the countdown timer going using the enrollment complete trigger, but unfortunately all the other enrollment complete triggers are waiting for the jamf helper countdown to complete before they run.

 

 

#!/bin/sh
/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -lockHUD -icon /Library/Desktop\ Pictures/PPSLogo.jpg -title "Tech Office" -heading "Please wait for install to complete..." -description "Installing all needed software..." -countdown -timeout 720 -alignCountdown right

 

 

I'm wondering if I just add a

&

to the end of a policy trigger before the caffeinate command, will that then run the install policy in the background?

Like "sudo jamf policy -trigger creativecloud &"

I always hate asking/bothering, but this seems like a @mm2270 style question.

The end result is I just want the jamf helper timer to pop, while the adobe creative cloud installs, but they currently are waiting for each other to finish before running.

Im also seeing some issues with the machine/screen going to sleep during this process so I was also trying to call the caffinate process. "caffeinate -i -s -d -t 900 &"  (Again this all happens right after enrollment complete during the first few clicks) before the login screen shows, usually during the enable location services screen).

 

Thanks for any help you can provide.

Gabe Shackney
Princeton Public Schools
1 ACCEPTED SOLUTION

GabeShack
Valued Contributor III

I was able to get this to work, however using the & after my jamf helper script just quit it out...so I have the few scripts run at the beginning with the & and then put the jamf helper timer after that which ended up looking like this:

#!/bin/sh
jamf policy
jamf policy -trigger creativecloud &
caffeinate -i -s -d -t 900 &
/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -lockHUD -icon /Library/Desktop\ Pictures/PPSLogo.jpg -title "Tech Office" -heading "Please wait for install to complete..." -description "Installing all needed software..." -countdown -timeout 720 -alignCountdown right
/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -lockHUD -icon /Library/Desktop\ Pictures/PPSLogo.jpg -title "Tech Office" -heading "Initial Setup Complete" -description "Click Continue for Login Screen" -button1 "Continue" -defaultButton 1

Since this script is triggered as the first after enrollment complete, it does a quick check for outstanding policies (initial recon) and then runs the timer.

 

Thanks all for your help with this!

Gabe Shackney
Princeton Public Schools

View solution in original post

3 REPLIES 3

emily
Valued Contributor III
Valued Contributor III

If you want other policies to run while the jamfHelper command sits there you'd want the `&` on the end of the jamfHelper command. That `&` lets the next command run asynchronously/as a background process. 

PaulHazelden
Valued Contributor

Caffeinate command, This is not my set up but it works I got it from a script by 

John Mahlman, University of the Arts Philadelphia (jmahlman@uarts.edu)

```

# Let's caffinate the mac because this can take long

    caffeinate -d -i -m -u &

    caffeinatepid=$!
<YOUR SCRIPT GOES IN HERE>

# No more caffeine please. I've a headache.

    kill "$caffeinatepid"

```

This will launch Caffeinate and continue with the script. Then once you get to the end of the script it will kill the captured PID of the Caffeinate proccess, thus returning the Mac back to its normal routine.

If you use the & to allow the next line of script to continue, it will do so. However I have found some caveats to that.

If the script later finishes, it wont report back to JAMF a completion until all of the lines ending with & have completed. If the script reboots the Mac, then the completion is never reported back to JAMF.

If you are using it to call a collection of policies, and then want to continue and have input further along and do something else, then I would leave the last of those called policies without the &. This way the script will halt and await the last process to complete before it will continue.

GabeShack
Valued Contributor III

I was able to get this to work, however using the & after my jamf helper script just quit it out...so I have the few scripts run at the beginning with the & and then put the jamf helper timer after that which ended up looking like this:

#!/bin/sh
jamf policy
jamf policy -trigger creativecloud &
caffeinate -i -s -d -t 900 &
/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -lockHUD -icon /Library/Desktop\ Pictures/PPSLogo.jpg -title "Tech Office" -heading "Please wait for install to complete..." -description "Installing all needed software..." -countdown -timeout 720 -alignCountdown right
/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -lockHUD -icon /Library/Desktop\ Pictures/PPSLogo.jpg -title "Tech Office" -heading "Initial Setup Complete" -description "Click Continue for Login Screen" -button1 "Continue" -defaultButton 1

Since this script is triggered as the first after enrollment complete, it does a quick check for outstanding policies (initial recon) and then runs the timer.

 

Thanks all for your help with this!

Gabe Shackney
Princeton Public Schools