[launchd-dev] Install and load a launch daemon without a reboot

Thomas Clement tclementdev at gmail.com
Thu Oct 13 00:53:32 PDT 2011


Very interesting.
This command should really be documented in the launchctl man page. There is currently no word about it.


On Oct 13, 2011, at 1:17 AM, Damien Sorresso wrote:

> That should be:
> 
> $ sudo launchctl asuser $DESIRED_UID launchctl bslist
> -- 
> Damien Sorresso
> dsorresso at apple.com 
> 
> On Oct 12, 2011, at 4:08 PM, Damien Sorresso wrote:
>> 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
>> 
>> _______________________________________________
>> 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