Manually Register a Daemon on a Mac OS X System
1. Log on to the system as the root user.
2. In the /Library/LaunchDaemons directory, create an init-script using the naming convention com.sag.sagrc-script_name.plist (for example, com.sag.sagis_default99.plist). If you need to create multiple init-scripts because you have multiple product instances on the same machine, use the naming convention sagunique_numberrc-script_name.plist.
3. Add the content below to the init-script.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- @full_path_to_rc-script@ -->
<plist version="1.0">
<dict>
<key>Label</key>
<string>description</string>
<key>ProgramArguments</key>
<array>
<string>/Library/LaunchDaemons/saglaunch.sh</string>
<string>full_path_to_rc-script</string>
<string>start</string>
</array>
<key>Disabled</key> <false/>
<key>RunAtLoad</key> <true/>
<key>KeepAlive</key> <false/>
<key>AbandonProcessGroup</key> <true/>
<key>UserName</key> <string>user_that_installed_products</string>
<key>GroupName</key> <string>group_for_user</string>
</dict>
</plist>
4. In the same directory, create a file named saglaunch.sh and add the content below. This script is a stub for calling all further rc-scripts after waiting 120 seconds for NFS to be available.
#!/bin/sh
# wait for disk and execute
i=120; while [ $i -gt 0 -a ! -f $1 ]; do sleep 1; i=`expr $i - 1` ; done
cd `dirname $1`
$*
5. Set execution permissions for saglaunch.sh.
6. Register the daemon by running this command:
launchctl load -w /Library/LaunchDaemons/init-script_name.plist