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

Damien Sorresso dsorresso at apple.com
Wed Dec 4 11:22:32 PST 2013


Why not just set a relevant environment variable or pass an argument that's different in each plist? 
-- 
Damien Sorresso
dsorresso at apple.com 

On 4 Dec, 2013, at 9:03, Norman Gray <norman at astro.gla.ac.uk> wrote:
> 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
> 
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> https://lists.macosforge.org/mailman/listinfo/launchd-dev



More information about the launchd-dev mailing list