jeudi 22 janvier 2015

How can I write a launchd service that will actually stop the service?


So I have a plist to keep monit running:



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://ift.tt/vvUEPL">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.monit.service</string>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/Cellar/monit/5.10/bin/monit</string>
<string>-d 60</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/var/log/monit.log</string>
</dict>
</plist>


I can do launchctl load /Library/LaunchDaemons/com.monit.service.plist to start the service, but launchctl unload /Library/LaunchDaemons/com.monit.service.plist will not stop it. I can see that the process keeps running no matter what I do.


The process shows up like this(note how the binary path doesn't show up, only the last argument):



root 14656 0.0 0.0 2482248 1656 ?? S 6:55PM 0:00.09 -d 60


How can I write the launchd plist so that it will actually stop the freaking process whenever I want it to stop?





Aucun commentaire:

Enregistrer un commentaire