[launchd-dev] Issue with LaunchAgents on Multiple users logged in

Arjun SM arjun.sm at gmail.com
Tue May 5 23:42:03 PDT 2009


Hi,
   I have written a small menulet application and is running as a
LaunchAgent. The problem that i am facing is while installing my app and in
situation when multiple Users are logged in,


   -  In my postflight i use the 'users' command to get as to how many users
   have logged in and launch my app in that Users context . Sample code


          # Launch Menulet for all the logged in Users
          for userName in `/usr/bin/users`
          do
                  echo "Loading Menulet for $userName"
                  su -l $userName -c "launchctl load -S Aqua
/Library/LaunchAgents/com.myname.menulet.plist"
          done

Now in a situation where i have opened the Terminal and logged in root, the
/usr/bin/users would now show as 2 users logged in and i would try to launch
my app in the roots context as well. Hence i am getting 2 Menulets with the
same User.

How can i solve this problem? Please help ...


thanks in advance
~Arjun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/launchd-dev/attachments/20090506/2f3543fb/attachment.html>


More information about the launchd-dev mailing list