create LaunchDeamon to run a script - recon on connection to JSS

New Contributor

Hi guys,
i have the following issue:
we are still on Mojave and are in the process of upgrading to catalina.
Eitherway we will upgrad evia Munki or the JSS.
But it occured to me that if i run a policy via Jamf, sometimes the policy starts, but is still pending after the update to Catalina was successful. And the policy starts again, because there was no inventory update to check that now Catalina is installed which is excluded via Smartgroup.

If i update via Munki, it also takes some time to update the inventory.
I would like to update the jamf inventory right at connection, so the configuration profiles for the PPPC for Catalina can be applied right at startup.

The other issue is that most of our users are in home office and are connection via VPN.
So the JSS is just aviable via VPN.

So my idea was the following:
a LaunchDeamon to launch a script at startup of the Mac.
The scripts trys to ping the JSS via IP with a loop.
if the ping is succesful it will stop and start a recon command.

Now the script itself works when used via the Terminal.
I checked the LaunchDeamon via Launch Control and this seems also to work but returns with Status 78.
The permissions and ownerships of both files are set.
Permissions: 664 ; root:wheel


<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" ""> <plist version="1.0"> <dict> <key>Label</key> <string>com.GT.checkJSSonline1.plist</string> <key>ProgramArguments</key> <array> <string>/Library/Scripts/ </string> </array> <key>RunAtLoad</key> <true/> <key>UserName</key> <string>root</string> </dict> </plist>

Script to ping our JSS: (ip adress was changed)


while true;
  ping -c1
  if [ $? -eq 0 ]
    jamf recon
    exit 0

I have no idea where i can look at.

Or maybe you got another idea how i can achieve this.
Thank you very much in advance.



Esteemed Contributor II

Should be root:wheel and 644.



I have updated the tags from Jamf Nation to JSS and Scripts to more closely align with the conversation. Please let me know if you disagree.