[launchd-dev] Can a launchd job get any access to its invoking plist?

Norman Gray norman at astro.gla.ac.uk
Wed Dec 4 09:03:43 PST 2013


Greetings.

Can a launchd job get any access to its invoking plist?

I'm writing a small application intended to be invoked, almost exclusively, from launchd.  Its interface would be simpler if it could read the contents of the dictionary/plist which controls the job which launchd starts.  It could potentially be invoked by more than one plist, and I'd like to preserve state keyed on (say) the job Label; it's invoked based on the WatchPaths element, and if it could see that key in the dictionary, then these paths wouldn't have to be duplicated in the ProgramArguments.  I can work round the problem, but it feels like I'm missing a trick.

Is there any way to get access to this dictionary; or (since I know about SMJobCopyDictionary) is there any way to get access to the job's Label?  The existence of SMJobCopyDictionary indicates that this information is available in principle.

I can't think of anything to google that gives me more than tutorials on using launchd.

I've tried asking on StackOverflow <http://stackoverflow.com/questions/20338636/>, but without success (the answer there is sensible, but somewhat tangential to the question).

Thanks for any pointers.

Best wishes,

Norman


-- 
Norman Gray  :  http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK



More information about the launchd-dev mailing list