Results 1 to 4 of 4
  1. #1
    launchctl/plist/launchdaemons on snow leopard

    Member Since
    Nov 11, 2009
    Posts
    2
    launchctl/plist/launchdaemons on snow leopard
    hello,

    i have to create a daemon on a Mac OSX. the daemon must start when the Mac boots up. i have therefore wrote a daemon (using RealBasic), and also wrote a plist file which points to the daemon. everything has been running just fine on Mac OSX 10.4 for months. Now i have copied everything to Snow Leopard 10.6 and am having a small problem. let me explain what i have done so far.

    1) i have created a plist file, called "myTestDaemon.plist", which lives in system/library/launchdaemons. the file is exactly this:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
    	"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    	<key>Label</key>
    	<string>myNewTestDaemon</string>
    	<key>ProgramArguments</key>
    	<array>
    		<string>/Users/Paul/Desktop/RealBasic_Projects/My_Application</string>
    	</array>
    	<key>RunAtLoad</key>
    	<true/>	
    </dict>
    </plist>
    2) as the above file describes, i have put the daemon, called "myNewTestDaemon", inside /Users/Paul/Desktop/RealBasic_Projects/My_Application

    3) i can then start the daemon using one of two methods - either by rebooting the Mac, in which case the launchd system tool automatically starts the daemon, or by starting the daemon manually using launchctl:

    Code:
    sudo launchctl load /system/library/launchdaemons/myTestDaemon.plist
    once i do either of the two above methods, i can verify that the daemon is started by doing:

    Code:
    sudo launchctl list
    and this shows that myTestDaemon.plist is indeed running.

    now, i have done exactly the same thing on my shiney new Mac mini with Snow Leopard on it, but when i do the "launchctl load ...." command, it gives me an error:

    Code:
    "nothing found to load"
    after a bit of snooping on the net i found that some people were saying that i have to add a "-F" flag to the command, so now it reads:

    Code:
    sudo launchctl load -F /system/library/launchdaemons/myTestDaemon.plist
    apparantly, all plists have a default key called "Disabled", which, if you do not explicitly set to false, is set to true by default. setting the -F flag tells launchctl to ignore this Disabled key, which effectively makes Disable=false. so, i tried the above command with the -F flag and sure enough, this time my daemon started.

    so i then explicitly added the key to my plist:

    Code:
    <key>Disabled</key>
    <false/>
    surely this should have the same affect ? apparantly not, because i still get the orginal "nothing found to load" error when i do the "launchctl load...." (without the -F flag). in addition, the daemon still does not start when the Mac boots up. and this is my problem.

    like i say, this was all working in 10.4, and now not working in 10.6. So i imagine something has changed between version ? does my plist file look right ? all i need the daemon to do is start up at boot time.

    hope i have explained it well. if not please ask for more info.

    any help appreciated.

  2. #2
    launchctl/plist/launchdaemons on snow leopard

    Member Since
    May 02, 2009
    Posts
    480
    Specs:
    MBP 2.33 4GB: MacPro 8 Core 2.8, 16GB: MacMini 2.26 4GB: MacMin 2.53 4GB: iPhone3GS 32GB
    Have a look at this:

    launchctl disabled key in 10.6? - macenterprise | Google Groups

    You may want to take a look at the /private/var/db/launchd.db/com.apple.launchd/overrides.plist file. Sounds like you service may have ended up there somehow. Thats the only thing I can think of. Everything else looks ok.

    Also, you may want to look at the logs in the /Applications/Utilities/Console application. Typically launchctrl gives extended information in the console logs.

    Oh, and welcome to the forums!

  3. #3
    launchctl/plist/launchdaemons on snow leopard

    Member Since
    Dec 08, 2009
    Posts
    1
    Hi-
    I am having this same problem. Did you ever figure out how to make it work?
    Thanks!

  4. #4
    launchctl/plist/launchdaemons on snow leopard

    Member Since
    Nov 11, 2009
    Posts
    2
    Quote Originally Posted by johnc82 View Post
    Hi-
    I am having this same problem. Did you ever figure out how to make it work?
    Thanks!
    right - this was ages ago, and i did get to the bottom of it but i cant remember what i did exactly

    heres the plist that im currently using, maybe it was extra keep-alive and disabled flags that made it work?

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
    	"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    	<key>Label</key>
    	<string>MyClientService</string>
    	<key>ProgramArguments</key>
    	<array>
    		<string>/Users/me/Desktop/RealBasic_Projects/Test/MyClientService</string>
    	</array>
    	<key>KeepAlive</key>
    	<true/>	
    	<key>Disabled</key>
    	<false/>
    	<key>RunAtLoad</key>
    	<true/>
    </dict>
    </plist>
    sorry i cant be of any more help, the project has been put on hold since i posted last so its been ages since i actually played around with this - good luck

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. LaunchDaemons won't execute .plist file on boot (noatime for SSD)
    By r4226 in forum OS X - Operating System
    Replies: 0
    Last Post: 11-29-2011, 01:43 AM
  2. Trouble with launchctl and Aqua session type
    By valley in forum OS X - Operating System
    Replies: 1
    Last Post: 09-02-2011, 07:57 AM
  3. Remove Snow Leopard Server and re-install Snow Leopard
    By b-rad in forum OS X - Operating System
    Replies: 4
    Last Post: 08-09-2011, 01:33 AM
  4. Replies: 6
    Last Post: 01-02-2011, 05:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •