We've expanded our news coverage and improved our search! Visit
news.oreilly.com for the latest or search for all things across O'Reilly!
| 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).
#!/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");
}
|