The Executable

Each startup item bundle contains an executable file. The executable (which is typically a shell script) must be at the root level of the bundle and have the same name as the bundle (eg. Network/Network).

SystemStarter runs the executable with a single argument indicating the action to be performed. The possible values of the argument are start, stop, and restart.

Because of the varied nature of startup items, it is impossible for SytemStarter to keep accurate records of which items may or may not be currently running. In the event a user manually starts or stops a bundle, is possible an executable may receive a start command while already started, or a stop command while already stopped. Therefore a well-designed startup item must be able to gracefully handle this condition.

SystemStarter examines the exit status of the startup item script to determine whether the provided services succeeded or failed. A successful exit status indicates all services succeeded, an unsuccessful exit status indicates all services failed. In the event of a partial sucess (some services succeed while other fail), the ConsoleMessage utility may be used to provide more accurate feedback to SystemStarter. Feedback from ConsoleMessage takes precedence over the scripts exit status, and SystemStarter will not override any status that has already been reported. Note that it is not recommended to issue muliple ConsoleMessage calls for a single service as this may cause unpredictable results. See the Returning Status with ConsoleMessage section for more information.