Women in Technology

Hear us Roar



Article:
  Start Me Up: Writing and Understanding OS X StartupItems
Subject:   Stop
Date:   2003-10-21 18:02:30
From:   anonymous2
So have they actually added support for running these things at shutdown yet, or is this still unimplemented?
Main Topics Newest First

Showing messages 1 through 3 of 3.

  • Stop
    2003-10-22 07:29:22  anonymous2 [View]

    No, Apple still hasn't figured out how to send Stop and Restart messages. Hopefully they will figure it out in Panther. Interesting, though, SystemStarter can be told to send Stop and Restart messages to the services and this works very well. I think you can pull up a man page on SystemStarter to see how to use it.
  • Stop
    2003-10-23 08:38:37  anonymous2 [View]

    Why would you have to specifically shutdown one item?
    I'm no expert but I think that a shutdown in unix kills all running processes. That would include the Tomcat server, Apache, MySql etc.
    It would be kind of redundant to write a specific shutdown item when shutting down the system.
  • Stop
    2006-12-04 08:00:13  gordguide [View]

    A service has a Start and Stop functions. Stop function is executed upon shutdown. You can leave the start function unused if you like so that it functions solely as a shutdown service.

    If you need a "nice" (ie orderly) shutdown, script it (shell, applescript, automator workflow, or any combination).

    #!/bin/sh

    . /etc/rc.common

    StartService ()
    {
    # what to do on boot (can be empty)
    }

    StopService ()
    {
    # what to do on shutdown (can be empty)
    }

    RunService "$1"

    This file has to be executable, i.e. chmod a+x filename. Then create a file by the name StartupParameters.plist with the following contents:

    StartupParameters.plist
    {
    Description = "Name of your service goes here";
    Provides = ("Whatever your service provides goes here");
    Uses = ("Disks");
    }