launchctl list anomaly when logged in as root user
I have an launchd User Agent with label com.mycompany.myAgent & a launchd daemon with label com.mycompany.myDaemon. I use the command $launchctl list com.mycompany.myAgent & $sudo launchctl list com.mycompany.myDaemon to view the PID of my job and it's LastExitStatus. Everything works fine when I'm logged in as a standard/admin user. When I login as root (System Administrator) although, I do not get the status of my agent. I can see my agent's executable running in the Activity Monitor app but $launchctl list does not show my agent. Is there a way I can query my agent when logged in as root?
$ launchctl -u root list Unrecognized subcommand: -u (On Mac OS X 10.10) On Sat, Apr 11, 2015 at 2:42 PM, Thomas Clement <tclementdev@gmail.com> wrote:
On 10 Apr 2015, at 07:30, Raunak Poddar <raunak.poddar@gmail.com> wrote:
Is there a way I can query my agent when logged in as root?
Did you try:
launchctl -u root list
-- Raunak Poddar
hmm ok, on 10.10 you can try the following:
launchctl print user/0/com.mycompany.myAgent
launchctl print gui/0/com.mycompany.myAgent
On 11 Apr 2015, at 13:20, Raunak Poddar <raunak.poddar@gmail.com> wrote:
$ launchctl -u root list Unrecognized subcommand: -u (On Mac OS X 10.10)
In general, I'd recommend using the new print subcommand for this kind of system administration-ish stuff. The semantics around the old commands (like load, unload, list, etc.) were highly context-dependent, and that led to tons of situations where people had perfectly reasonable expectations (such as Raunak's) about being able to query a job loaded in a certain session, but due to (mumble mumble Mach, POSIX, bootstraps, sockets), you'd get completely different behavior. The new print subcommand requires you to specifically target sessions and jobs (now called domains and services) rather than trying to sniff out which one you mean based purely on context. And it prints way more information, such as where the service was loaded from on-disk (if it came from on-disk), much more detailed last exit status, and more. -damien On 11 Apr, 2015, at 04:33, Thomas Clement <tclementdev@gmail.com> wrote:
hmm ok, on 10.10 you can try the following:
launchctl print user/0/com.mycompany.myAgent
launchctl print gui/0/com.mycompany.myAgent
On 11 Apr 2015, at 13:20, Raunak Poddar <raunak.poddar@gmail.com <mailto:raunak.poddar@gmail.com>> wrote:
$ launchctl -u root list Unrecognized subcommand: -u (On Mac OS X 10.10)
_______________________________________________ launchd-dev mailing list launchd-dev@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/launchd-dev
participants (3)
-
Damien Sorresso
-
Raunak Poddar
-
Thomas Clement