4

I am looking for an alternative way asides using NSTask/system() to run "launchctl load (plist)". Is there an API for this? Something like CFLaunchdHelper or NSLaunchd. I tried searching but didn't find any and TN2083 doesn't have any info about this.

radj
  • 4,360
  • 7
  • 26
  • 41
  • What are you trying to do with your launch agent? Are you looking to run a helper tool? A script? Quite possibly, there are better ways to do this than with a launch agent... – Itai Ferber Mar 07 '12 at 11:34
  • radj, have you found a solution? I'm in a similar situation, where I need to programmatically run an agent. In my case, the scheduled task need to be configurable by users at any time. So I need to create/update agents programmatically. – Marcelo Sep 11 '14 at 17:40
  • 1
    @mthama I think I did using the answer below. But I'm sorry I already forgot and I no longer have the codes to this as it was proprietary to a former company :/ – radj Sep 12 '14 at 00:42
  • Well... you gave an important information. You have succeeded launching it programmatically (ins't it?). By knowing that it is possible in some way, I can search for the solution with more confidence. Thank you. =) – Marcelo Sep 12 '14 at 17:20

1 Answers1

3

Have a look at /usr/include/launch.h. A quick search revealed this link, seems useful.

fbernardo
  • 10,016
  • 3
  • 33
  • 46