LaunchDaemon runs script, calls jamf policy with jamfhelper issue

user-TwVuRpLMFk
New Contributor

Hi all,

I have created a LaunchDaemon that runs at load, which runs a script that calls a Jamf policy. The policy calls a script. The daemon does run successfully and calls the policy which runs the script which contains jamfhelper windows.

The problem is when the script gets to the point of calling the jamfhelper, it just hangs. To troubleshoot, I have created a very simple script that just launches a jamfhelper window, and I see the same behavior, just hangs.

If I run the script from the terminal, it executes and displays the jamfhelper window.

Any help is appreciated,
Thanks

#!/bin/bash
# Ran in a previous script before a reboot
/bin/cat << EOF > "/Library/LaunchDaemons/com.myTest.test.plist"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.myTest.test</string>
    <key>Program</key>
    <string>/Library/Scripts/test.sh</string>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>
EOF


    /bin/cat << EOF > "/Library/Scripts/test.sh"
#!/bin/bash
/usr/local/bin/jamf policy -event testJamfHelper
EOF
#!/bin/bash
# Script that runs when testJamfHelper is called
title="Test title"
icon="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarAdvanced.icns"

logfile="/var/log/JAMFtest.log"

/bin/echo "Starting test script" >> $logfile

/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -icon "$icon" -title "$title" -heading "Test" -description "Test Successful
Please click OK to continue"  -iconSize 100 -button1 "OK" -defaultButton 1

/bin/echo "Script test done" >> $logfile
1 REPLY 1

mtafirozee
New Contributor II

You can try putting a "&" at the end of the following line.

/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -icon "$icon" -title "$title" -heading "Test" -description "Test Successful
Please click OK to continue"  -iconSize 100 -button1 "OK" -defaultButton 1 &