开发者

Startup Items - Creating a basic one

Please save me from a potential nervous breakdown!

I've been following Apples documentation (see below) on how to create a Startup Item. Currently I'm just trying to get my script to print something to the console, much less actually run my app.

Here are my two scripts, one is the startup executab开发者_JAVA技巧le, the other is the plist:

#!/bin/sh
. /etc/rc.common

# The start subroutine
StartService() {
# Insert your start command below.  For example:
echo "hey Eric we've started" 
# End example. 
  }

# The stop subroutine
 StopService() {
# Insert your stop command(s) below.  For example:

  echo "STOPPED ERIC"

# End example.
    }

   # The restart subroutine
     RestartService() {
    # Insert your start command below.  For example:

echo "RESTART ERIC"


    # End example.
       }

 RunService "$1"






 {
 Description     = "Software Update service";
   Provides        = ("SoftwareUpdateServer");
  Requires        = ("Network");
   Uses            = ("Network");
   OrderPreference = "Late";
    Messages =
   {
     start = "Starting Software Update service";
     stop  = "Stopping Software Update service";
     };
  }

Using terminal I tried to set the permissions as closely as possible as to how it is documented in the example in the link below. The odd thing was that the files didn't show the 'root' aspect to their ownership.

I then ran SystemStarter start theApp and nothing happens. Absolutely nothing.

Any help?

http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/StartupItems.html


You should not create a Startup Item any more. It's a legacy mechanism and superseded by launchd. Write a plist for launchd instead. I know this is not the help you wanted, but sadly with Apple, you need to follow the mothership...

Read this section of the same document instead.

See the document just you quoted yourself:

Note: The launchd facility is he preferred mechanism for launching daemons in Mac OS X v10.4 and higher. Unless your software requires compatibility with Mac OS X v10.3 or earlier, you should use the launchd facility instead of writing a startup item. For more information, see “Guidelines for Creating and Launching Daemons.”

Note that v10.4 become available in 2005.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜