multiple jamfhelper messages

DirkM2012
Contributor

Hello everybody,

I have a test script that is showing 3 messages and which works fine in terminal

#!/bin/sh
echo "test1";
test1=`/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -heading "Test" -description "Test" -button1 "Yes"`;
echo "test2";
test2=`/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -heading "Test" -description "Test" -button1 "Yes"`;
echo "test3";
test3=`/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -heading "Test" -description "Test" -button1 "Yes"`;
exit 0

However, when I execute this script via CasperRemote or policy, it won't display message 2 and 3. The log shows that test2 and test3 but the is no message showing up.

Am I missing something or can I only have a single message in a script?

Thanks,
Dirk

3 REPLIES 3

mm2270
Legendary Contributor III

Try using an ampersand (&) at the end of your first 2 jamfHelper lines to push them into the background to allow the 3rd one to show up.

#!/bin/sh
echo "test1";
test1=`/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -heading "Test" -description "Test" -button1 "Yes"` &
echo "test2";
test2=`/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -heading "Test" -description "Test" -button1 "Yes"` &
echo "test3";
test3=`/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -heading "Test" -description "Test" -button1 "Yes"`;
exit 0

Only thing is, the way you have this, all 3 messages will overlap each other, unless you position each one in a different screen corner. Might I ask the use case of needing 3 simultaneous jamfHelper windows?

DirkM2012
Contributor

I don't really need 3 at the same time, it's more like

do something
show message 1
do someting else
show message 2
finish up everything
show message 3

I found another posting about the -startlaunchd flag which makes all 3 messages appear when they are supposed to appear

#!/bin/sh
test1=`/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -heading "Test" -description "Test" -button1 "Yes" -startlaunchd`;
echo "test1 returned $test1";
test2=`/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -heading "Test" -description "Test" -button1 "Yes" -startlaunchd`;
echo "test2 returned $test2";
test3=`/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -heading "Test" -description "Test" -button1 "Yes" -startlaunchd`;
echo "test3 returned $test3";
exit 0

So that's resolved. However, that brings me to my next question: Why do I not see the echos in jamf.log but only in the log in jss?

Thanks,
Dirk

mm2270
Legendary Contributor III

OK, I see what you mean now. Sorry, misunderstood. Yeah, the -startlaunchd flag is kind of magical at times in that it makes things work where they previously did not. I'm not even clear on why.

As for the echo's not showing up, to my knowledge, anything going to stdout, like echoes, go to the log, not the jamf.log. The jamf.log only captures the fact that a policy ran and a script was downloaded, etc. Its not going to show up there.