On OSX, using launchctl to start and stop a service seems great, however I don’t see it anyway to check the return value to make sure it really started. The return value is always returned as zero, even when the service did not start.
This plist file contains an error and, therefore, will not start "Rain" as expected
% launchctl start /Library/LaunchDaemons/org.drizzlebad.plist % echo $? 0
Any suggestions other than checking for the presence of a pid file for this service?
You must do something wrong, because it launchctlreturns 0 only on successful execution:
launchctl
$ launchctl start foobar launchctl start error: No such process $ echo $? 1
, launchctl start ( , DNS-), plist. launchctl load unload, plist.
launchctl start
launchctl load
unload
, , grepping launchctl list , , .
launchctl list
launchctl list , - ... 0 -s... , .... -1, -251, ... ... startd ... launchctctll " " - 10 ..... , .
-w.... plist , , (, , ) . -w plist /var/db/launchd, , , . , "" XML Plist... , , , , ...
, overrides.plist tat var , ... , . , , , ...