[launchd-dev] Agent terminating & Fast User Switching
Dave Zarzycki
zarzycki at apple.com
Tue Jun 24 12:18:25 PDT 2008
Peter,
For all practical purposes, launchd and AppleEvents are oblivious of
each other. This may change in a future version of the OS, but for
now, you'll just need to find a workaround.
Sorry,
davez
On Jun 24, 2008, at 10:55 AM, Peter Alshuth wrote:
> Hi all,
>
> I have an agent running for each user session that gets launched when
> the user logs in and will be terminated on a logout.
>
> In order to have the background agent running even if the user quits
> it I use the key to KeepAlive (I check the reason for the quit event
> and return 0 or 1).
>
> Everything works fine when only one user is logged in and out. But
> when I log out from a fast user switching it will be restarted:
>
> He agent fist received the quit event and will terminate by calling
> exit(1) at the very end. Unfortunately, it will be relaunched during
> the user logout and the process will immediately receive SIGTERM
> signal that I also response to.
>
> <plist version="1.0">
> <dict>
> <key>KeepAlive</key>
> <dict>
> <key>SuccessfulExit</key>
> <true/>
> </dict>
> <key>Label</key>
> <string>com.mycompany.myAgent</string>
> <key>OnDemand</key>
> <false/>
> <key>ProgramArguments</key>
> <array>
> <string>/usr/local/MyStuff/MyAgent.app/Contents/MacOS/
> MyAgent</string>
> </array>
> <key>RunAtLoad</key>
> <true/>
> </dict>
> </plist>
>
>
> Is there anything I am missing or doing wrong?
>
> Thanks for any help,
> Peter
>
>
> _______________________________________________
> 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