making a login script wait for the folder

ianatkinson
Contributor

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 com.apple.dock.plist, if that happened before the default com.apple.dock.plist 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.

Thanks,

Ian

3 REPLIES 3

gachowski
Valued Contributor II

How about waiting for the dock of the user to load?

https://www.jamf.com/jamf-nation/discussions/26183/dep-enrollment-confirming-user-is-fully-logged-in

I use "mbezzo" answer in that thread.

C

ianatkinson
Contributor

That sounds like a good idea thank you, I guess the dock does pop up last so it makes sense that things should be just about complete when that happens but I'll do some testing to make sure also!

mm2270
Legendary Contributor III

Waiting for the Dock to be running is typically what I've done as well. It generally always works. There may be some very rare instances where it doesn't, but it should get you where you want.