AFP548 Changing the world one server at a time.

Only three out of four Launch Daemons run

Home › Forums › Software › InstaDMG › Only three out of four Launch Daemons run

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #379083
    jasonkstupski
    Participant

    Hey there,

    I’m building a Snow Leopard image, and putting in a few LaunchDaemons to run scripts at startup:

    1. Activate ARD for a particular administrative user.
    2. Activate SSH.
    3. Add our workgroup printers.
    4. Run the local MCX startup script to check for the MAC address and append it into the right file in /private/var/db/dslocal/nodes/Default/computers/

    For some reason, only the last one doesn’t run. I’m stumped. The permissions are the same on all four, all four have scripts residing in the same place with the same permissions. Even when I run the last one using launchctl, it works fine. But it just won’t kick off at startup. Is there something else I need to check? This is driving me bonkers!

    I’ve had the same local MCX Launch Daemon running just fine on my Leopard builds. Maybe there’s something different with Snow?

    Any suggestions or pointers would be most appreciated.

    Thanks,
    Jason

    #379088
    jasonkstupski
    Participant

    Hey all,

    Here’s my plist and shell script file. Any help would be so appreciated!!

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    	<key>Disabled</key>
    	<false/>
    	<key>Label</key>
    	<string>com.stupski.ActivateMCX</string>
    	<key>ProgramArguments</key>
    	<array>
    		<string>/Applications/Utilities/Scripts/ActivateMCX.sh</string>
    	</array>
    	<key>RunAtLoad</key>
    	<true/>
    </dict>
    </plist>

    Here are the permissions on that file:

    -rw-r--r--@  1 root  wheel   423 Jul 14 08:50 ActivateMCX.plist

    And here’s the shell script. I even mega-simplified it from my original one:

    #!/bin/sh
    MAC=`ifconfig en0 | awk ' /ether/ {print $2}'`
    dscl . -delete /Computers/local_laptop ENetAddress
    dscl . -create /Computers/local_laptop ENetAddress $MAC

    And the permissions on that file:

    -rwxr-xr-x@  1 root  wheel   164 Jul 13 17:27 ActivateMCX.sh

    Thanks!!
    Jason

    #379089
    Rusty Myers
    Participant

    I have all my launchd items call a script with a shell:
    Does that help?

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    	<key>Disabled</key>
    	<false/>
    	<key>Label</key>
    	<string>com.stupski.ActivateMCX</string>
    	<key>ProgramArguments</key>
    	<array>
    		<string>/bin/bash</string>
    		<string>/Applications/Utilities/Scripts/ActivateMCX.sh</string>
    	</array>
    	<key>RunAtLoad</key>
    	<true/>
    </dict>
    </plist>

    jasonkstupski wrote:

    Hey all,

    Here’s my plist and shell script file. Any help would be so appreciated!!

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    	<key>Disabled</key>
    	<false/>
    	<key>Label</key>
    	<string>com.stupski.ActivateMCX</string>
    	<key>ProgramArguments</key>
    	<array>
    		<string>/Applications/Utilities/Scripts/ActivateMCX.sh</string>
    	</array>
    	<key>RunAtLoad</key>
    	<true/>
    </dict>
    </plist>
    #379090
    jasonkstupski
    Participant

    Thanks Rusty.

    No change here. I now see that it must be doing something – when I run dscl . read /Computers/local_laptop, it now populates ENetAddress with a blank field. Not sure what’s going on there. Perhaps my script is busted?

    Strangely enough, if I run the script by itself, it populates it correctly. Then, when I restart, it wipes ENetAddress out every time. Testing now by taking out the “delete” line. Totally confused..

    Thanks,
    Jason

    #379091
    jasonkstupski
    Participant

    Okay, took out the delete line, but it’s still making the field blank. Not sure what could be causing this – is it that at startup, the command

    MAC=`ifconfig en0 | awk ‘ /ether/ {print $2}’`

    is pulling back a blank address?

    Thanks,
    Jason

    #379093
    jasonkstupski
    Participant

    I’ve got it.

    I needed to run this line:

    /usr/sbin/networksetup -detectnewhardware # just to make sure that it is done

    As shown in this post: https://www.afp548.com/forum/viewtopic.php?forum=45&showtopic=23782

    Thanks!
    Jason

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.