Launchd won’t run a loaded script on reboot

launchd

so i'm having a few troubles with launchd

I made this plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs$
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>mosek.mountd</string>
    <key>ProgramArguments</key>
    <array>
        <string>/etc/mountd</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

My problem is this. When i load the script manually:

launchctl load /Library/LaunchDaemons/script.plist

It works like a charm. It load perfectly, and runs the script as it should.
now when I reboot, it loads the script as it should, but now the script won't start.
Though when I start the script

launchctl start mosek.mountd

it works. So it must be ignoring the "RunAtLoad" key, when it loads the script on reboot. Why does it do that, and how do I fix it?

cheers in advance

edit:
    I forgot to mention that I also made root the owner of the file by running:
         chmod root /Library/LaunchDaemons/script.plist
    and it still wouldn't work

Best Answer

Check your permissions. The file script.plist should look like this

-rw-r--r-- 1 wheel 410 16 ...

From man launchctl

Note that per-user configuration files (LaunchAgents) must be owned by the user loading them. All system-wide daemons (LaunchDaemons) must be owned by root. Configuration files must not be group- or world-writable.