scripting with jamfhelper and jamf binary

londonmetmacsys
New Contributor II

i have an applescript / shell script combi that puts up the jamfhelper screen while it calls the policies, but the 'do shell script jamf policy' runs as a sub process from the applescript, thus while this is running, the applescript continues, even though the policies are still running, eg software install.

I've looked at various methods of tying to monitor the jamf process / cpu usage, but i'm not getting that far..

any suggestions?

all i need is for the jamfhelper screen to come on, policies run, jamfhelper screen is removed.

thanks.

3 REPLIES 3

dpertschi
Valued Contributor

What does the AppleScript do? I'd separate out jamfhelper from whatever your doing with AppleScript.

That part aside, you can simply add a Before script to your policy which triggers jamfhelper and then terminate the jamfhelper process after the policy runs by using the Run Command on the Advanced tab of the policy.

londonmetmacsys
New Contributor II

Hi,

thanks for the reply, the applescript provides a means for entering asset / building / room info after imaging, then applying policies, its interactive.. the jamfhelp is being used to provide feedback... at some point i'll get cocadialog into the mix.. but this will do for now..

this is what I came up with.. and.. it works.. for me.. i'm sure there 101 better ways.. but..

---
do shell script "jamf policy > /dev/null 2>&1 & echo $!" password "damnitshottoday" with administrator privileges

set pid to the result
repeat set loop to do shell script "ps aux | grep " & pid & " | grep -v grep | awk '{print$1}'" if loop is "" then exit repeat
end repeat
display dialog "foo" --this isn't really what is does at the end..
---

londonmetmacsys
New Contributor II

ok.. so this doesn't 'quite' work after all..