I've seen some good information on how to keep an NSTask running in the background, although that's not entirely what I want to do. What I would like to do is periodically run an NSTask in the the background (like every 30 seconds), then kill it; here might be one example of what I would like to do:
NSTask *theTask = [ [ NSTask alloc ] init ];
NSPipe *taskPipe = [ [ NSPipe alloc ] init ];
[ theTask setStandardError:taskPipe ];
[ theTask setStandardOutput:taskPipe ];
[ theTask setLaunchPath:@"/bin/ls" ];
[ theTask setArguments:[ NSArray arrayWithObject:@"-l" ] ];
[ theTask launch ];
// Wait 30 seconds, then repeat the task