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

Stephane Sudre dev.iceberg at gmail.com
Wed Oct 12 14:23:34 PDT 2011


/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!


More information about the launchd-dev mailing list