chown33 - launchagent-daemon help if you could assist

Discussion in 'Mac Programming' started by NixxereBB, Jun 11, 2013.

  1. NixxereBB macrumors newbie

    Jun 11, 2013
    Hello, I'm new to the forum, and saw a post from some time ago answered by chown33, and thought I'd see if I could get some direction from you in a new post rather than reply to an old one. Do you have an example of this type of plist I could use as a base, and is it able to run a app compiled applescript before login, or is it constrained to only be able to run certain types of scripts/programs? THANKS for any help/example plist you can offer!

    Originally Posted by CodeBreaker View Post
    Correct me if I am wrong. I believe Launch Agents are run on behalf of a user and hence need a user to be logged in to the OS, whereas Launch Daemons can be run even if no one is logged into the OS.

    That's basically right, but see the man pages for launchd.plist and launchctl. Look at the plist key LimitLoadToSessionTypes, then at the -S option to launchctl which lists the session types. The LoginWindow session type will run a launch agent at the login window. For example, I have a wacom graphics tablet whose LaunchAgents plist file contains Aqua and LoginWindow session types. This means it runs even when no one is logged in. The file is owned by root, and is unwritable to others.

    I have not experimented with the other session types.
  2. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
  3. NixxereBB thread starter macrumors newbie

    Jun 11, 2013
    Thanks, I'll take a look at the link you provided..

    Here is the post that brought me to your answer:

    Basically, I am trying to get an app to run without a login on system start, and found that Aqua session was required (errno 5).. I'd pretty much given up until I saw your post referencing the session control, so I've started reading the man pgs you gave to see what I can learn.
  4. NixxereBB thread starter macrumors newbie

    Jun 11, 2013
    Thanks chown33!

    with the reference to 'loginwindow' and 'background' the app runs both before login as well as while any user is logged in..

    Thanks for the help.

    This is what I used in case any others are looking for similar functionality:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
    <plist version="1.0">

Share This Page