launchd daemon not starting correctly on launch
Hi All,
I have a script that I like to have run anytime my wireless network changes. The script needs to be run under sudo, so I created a daemon inside of /Library/LaunchDaemons .
My plist file looks like this:
<?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>my.plist.name</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/script/to/run.sh</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Library/Preferences/SystemConfiguration/com.apple.airport.pr eferences.plist</string>
</array>
</dict>
</plist>
So here's where the oddness starts happening. When I start up my computer, launchctl tells me that this daemon is loaded. (I run sudo launchctl list and it's there). However, the script does not run when it should.
However, if I manually unload and then load the plist using the launchctl command then everything works completely fine.
So the question is, why does it work when I load it manually, but not work when the system loads it on startup?
Thanks,
Q
MacBook Pro, Mac OS X (10.7.2)