osx - How to run launchd agent/daemon from a NSApplication? -
in nsapplication i've button. when click it, want launch/start daemon/agent. how can proceed? i've tried:
- (void) runagent { nstask *task = [[nstask alloc] init]; task.launchpath = @"launchctl load /system/library/launchagents/com.mycompany.myagent.plist"; [task setlaunchpath:@"/bin/sh"]; [task launch]; }
with no success...
nstask *task = [[nstask alloc] init]; [task setlaunchpath:@"/bin/launchctl"]; [task setarguments:[nsarray arraywithobjects:@"load",@"/system/library/launchagents/com.mycompany.myagent.plist", nil]]; [task launch];
Comments
Post a Comment