JamfHelper... keep window open while process running

ooshnoo
Valued Contributor

i have a script that runs software update via JamfHelper, however I cannot get the actual software update command (via API) to run untiless the JamfHelper window is quit.

 

Anyone know how to run a process while still keeping the JamfHelper window open/active?  my syntax is as follows:

 

/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper \
-windowType hud \
-lockHUD \
-title "macOS Security Updates" \
-heading "macOS Updates Now Installing" \
-description "Installation can take up to 45 minutes.. Close and save your work now."


/usr/bin/curl -s -X POST -H "Content-Type: text/xml" -u ${apiUsername}:${apiPassword} ${jamfProURL}/JSSResource/computercommands/command/ScheduleOSUpdate/action/install/id/${jamfProCompID}
1 ACCEPTED SOLUTION

talkingmoose
Moderator
Moderator

Scripts run sequentially, which means one thing before another and one at a time. One command must finish before the next command will run.

So long as the JamfHelper window appears on screen, the JamfHelper process halts the script. It's waiting for input from the end user to close the window, which terminates the command and allows it to move on to the next command.

The solution is pretty simple. Add a space and an ampersand ( & ) to the end of your JamfHelper command. An ampersand at the end of any command spins it off on its own. The window can remain open while allowing the script to continue.

 

...
-description "Installation can take up to 45 minutes.. Close and save your work now." &

 

 

View solution in original post

3 REPLIES 3

talkingmoose
Moderator
Moderator

Scripts run sequentially, which means one thing before another and one at a time. One command must finish before the next command will run.

So long as the JamfHelper window appears on screen, the JamfHelper process halts the script. It's waiting for input from the end user to close the window, which terminates the command and allows it to move on to the next command.

The solution is pretty simple. Add a space and an ampersand ( & ) to the end of your JamfHelper command. An ampersand at the end of any command spins it off on its own. The window can remain open while allowing the script to continue.

 

...
-description "Installation can take up to 45 minutes.. Close and save your work now." &

 

 

Awesome!  Thanks Bill!!!  It proper worked great!

markopolo
Contributor

My window isn't staying open, but I'm calling jamfHelper from an IF-THEN statement (I want it to stay open after they click button2). Any ideas?

if [[ $bytes -gt 0 ]]; then
    userChoice=$("$jamfHelper" -windowType utility -title "$title" -heading "$heading" -alignHeading left -description "$description" -button1 "$button1" -button2 "$button2" -defaultButton 2 -cancelButton 1 -icon "$icon" &)
    if [ "$userChoice" == "2" ]; then
        open -a TextEdit "/usr/local/qualys/cloud-agent/log4j_findings.stdout"
    else
        exit 0
    fi
fi