简体   繁体   中英

launchd doesn't launch my daemon

I'm trying to figuring out why my daemon doesn't be launched automatically (on Mac 10.8.3). However, it works well on other machines. Here is my plist under /Library/LaunchDaemons/

<?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>Label</key>
    <string>com.MyApp.tmsm.launcher</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Library/Application Support/MyApp/tmsmLauncher</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <false/>
    <key>StartInterval</key>
    <integer>60</integer>
  </dict>
</plist>

I didn't see any error messages in /var/log/system.log . I have checked the permission and owner of my daemon . If i put my plist under /System/Library/LaunchDaemons/ , it can be launched after reboot . But it's not a good solution for me. If i use " launchctl load /Library/LaunchDaemons/com.MyApp.tmsm.launcher ", it works well. If i install other commercial software which is a daemon and have a plist under /Library/LaunchDaemons/ , it can't be launched, too.

It seems any plist under /Library/LaunchDaemons/ isn't loaded by system. I also try to turn on launchctl debug level with the command, " launchctl log level debug ", but there is no more messages after reboot. Is the debug level reset after reboot? Is other logs or configs i can check??

Thanks.

Try to load it with -w parameter: sudo launchctl load -w /Library/LaunchDaemons/blablabla.plist . Looks like problem in Disabled key. see man launchctl for details.

If that will not work I suggest you to enable some logging to file in your daemon to see if it starts (may be it just exits immediately?)

I found the root cause...It's quite stupid... The permission of my plist under /Library/LaunchDaemons/ is correct. However, the permission of /Library/LaunchDaemons/ is modified to 755. That's why any daemons registered under /Library/LaunchDaemons/ can't be loaded automatically...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM