making a login script wait for the folder


This is my first post so I just wanted to say Hi and introduce myself before I wade into a question!

I'm the Senior Infrastructure Engineer at Leeds Arts University and we have just bought JAMF for this coming year. I've been happily using DeployStudio for years on end but like many others am now forced down the MDM route due to the T2 chips etc.

I'm currently trying to get everything set up on a very tight deadline and am finding the whole thing more stressful than fun at the moment! I've had 2 weeks since the onboarding and I've got about 2 more weeks before the FE students come back so I'm basically trying to convert a ~45 page build script and about 15 monolithic images into JAMF on my own in a month :/

Anyways I've got most of the basic stuff done and packages built and I'm up to the template and preferences type stuff which isn't so straightforward.

Before I start on the AD users I was trying today to do some preferences for my admin user which I create within one of my initial policies. I made a policy to run when the admin user logs in for the first time to set up the dock for practice.

This seems to work but it got me thinking whether there's a race condition as I'm unsure if a JAMF policy set to run at login would be waiting for the home folder to finish being populated before executing?

So for example if I run some dockutil commands in a login policy these will edit, if that happened before the default was created during that first login I think the OS would then overwrite it. The same would presumably apply for any other plists, there's no point me doing any defaults write commands until the files are actually there.

If everything is going on at the same time I wonder if there's a reliable way to know when the login is complete and all the folders are populated so the script can be forced to wait?

Although I could just push out the plist for the admin user my AD users will get a fresh local folder on every login so I need to understand the sequence if possible.