Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question on using launchd



Greetings,

I'm working on a preference pane that is used to configure the options of a faceless background process (a music server).

This process is a BSD process for historical reasons, but will run under the privileges of a particular user, and not as root.

So, I want to make it into a "UserAgent", to start when the user logs in and quit when they log out.

I would also like to be able to have the server be manually launched, but still quit when the user logs out.

I have figured out how to create the appropriate plist to make the server launch at login and quit at shutdown, and that seems to work fine.

So, I have two questions:

1) Is it possible to set up launchd to not launch the process at login, but to shut it down at logout?

2) I want this all to be controlled by my preference pane. Obviously, it's no trouble to get it to write out the required plist file, but the part I'm not sure about is how to do the equivalent of a "launchctl load" or "launchctl unload" operation. I could exec this, I guess, but I prefer to use a proper C API rather than the exec mechanism whenever I can.

Thanks in advance,
--Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.