ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button
Subject:   Stop
Date:   2006-12-04 08:00:13
From:   gordguide
Response to: Stop

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).


. /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:

Description = "Name of your service goes here";
Provides = ("Whatever your service provides goes here");
Uses = ("Disks");