I've been trying to solve this myself for hours and I've been receiving the same error no matter what I try.
I'm trying to write a launchagent plist with keepalive to ensure that in my stripped down NetBoot environment. If someone accidentally closes Casper Imaging it will re-open it. Simple, right?
I used LaunchControl to run a simple "open" command on the application and on my personal laptop it worked wonderfully. I'd close the app, it'd re-open. Perfect. It's just not the same level of simplicity when trying to implement this on the root user account. Something isn't translating and I don't know what it is.
Setting up LaunchControl the same way I did in my test, but this time logged in as root, only produces this error:
LSOpenURLsWithRole() failed with error -10810 for the file /Applications/Casper Imaging.app.
I even tried changing my NetBoot image to use a local admin account instead of root and configuring LaunchControl to run the process as root. That's the closest I got to accomplishing my goal, but the strange thing is that Casper Imaging would open, load, and quit itself right before the JSS authentication prompt. The launchagent would then re-open the app, and it would quit again, and so on.
Has anybody accomplished this already so I don't have to re-invent the wheel? Any ideas? Tips?
I'm not positive why this is failing. If I paste the same command that is specified in LaunchControl into Terminal, then Casper Imaging opens without an issue.