[launchd-dev] Install and load a launch daemon without a reboot
Damien Sorresso
dsorresso at apple.com
Wed Oct 12 16:08:17 PDT 2011
In Lion, launchctl now has an asuser subcommand. Give it a shot:
$ sudo launchctl asuser $DESIRED_UID bslist
--
Damien Sorresso
dsorresso at apple.com
On Oct 12, 2011, at 2:29 PM, Thomas Clement wrote:
> Not that simple.
> You must switch into the appropriate user context which turns to be quiet complicated and unsupported.
>
> Please see:
> http://lists.macosforge.org/pipermail/launchd-dev/2011-January/000890.html
>
>
> Thomas
>
> On Oct 12, 2011, at 11:23 PM, Stephane Sudre wrote:
>
>> /usr/bin/su $USER -c
>>
>> On Wed, Oct 12, 2011 at 9:01 AM, Jeremy Reichman <jaharmi at jaharmi.com> wrote:
>>> I'm resurrecting an old thread -- but it was my thread, and I have a
>>> slightly new spin on it.
>>>
>>> Is it appropriate to start a LaunchAgent for the current user (with
>>> LimitLoadToSessionType: Aqua) via a script (such as post{install,upgrade})
>>> in an installer? I don't remember this being covered in TN2083, and my
>>> quick re-review of the tech note didn't turn anything up.
>>>
>>> If so, is there an acceptable method or process to load the agent?
>>>
>>> I am able to load a LaunchDaemon via an installer script, and have done so
>>> via the recommendation of checking to make sure EUID and RUID are 0. My
>>> Python code from earlier in the thread.
>>>
>>> import posix
>>> if posix.getuid() and posix.geteuid() == 0:
>>> # launchctl here
>>>
>>> At the very least, I'd expect you'd need to find the current user and load
>>> the agent in that account's context even though the installer and its
>>> scripts are running with EUID/RUID 0.
>>>
>>>
>>> Thanks!
>> _______________________________________________
>> launchd-dev mailing list
>> launchd-dev at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
>
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
More information about the launchd-dev
mailing list