Skip to main content
Question

LaunchDaemon runs script, calls jamf policy with jamfhelper issue

  • June 16, 2021
  • 1 reply
  • 0 views

Forum|alt.badge.img+2

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

Forum|alt.badge.img+1
  • New Contributor
  • 9 replies
  • November 25, 2021

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 &

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings