Exit Print View

Sun OpenDS Standard Edition 2.0 Command-Line Usage Guide

Get PDF Book Print View
 

Document Information

Directory Server Administration Tools

create-rc-script

dsconfig

dsreplication

manage-tasks

setup

status

start-ds

stop-ds

uninstall

upgrade

windows-service

Data Administration Tools

LDAP Client Utilities

Other Tools

General Tool Usage Information

create-rc-script

The create-rc-script command generates a shell script to start, stop, and restart the directory server.

Synopsis

create-rc-script [options]

Description

The create-rc-script command can be used to generate a shell script to start, stop, and restart the directory server. You can update the resulting script to suit the needs of your directory service. This command is available for UNIX or Linux systems only.


Note - On Solaris 10 systems, the functionality provided by RC scripts has been replaced by the Service Management Facility (SMF).


create-rc-script uses OPENDS_JAVA_* variables, not JAVA_* variables.

For more information, see Directory Server System Requirements in Sun OpenDS Standard Edition 2.0 Installation Guide.

Options

The create-rc-script command accepts an option in either its short form (for example, -f filename) or its long form equivalent (for example, --outputFile filename).

-f, --outputFile filename

Specify the path to the output file.

-j, --javaHome javaHomePath

Specify the path to the Java installation that should be used to run the server.

-J, --javaArgs javaArgs

Specify the set of arguments that should be passed to the JVM when running the server.

-u, --userName userName

Specify the name of the user account under which the server should run. The user account must have the appropriate permissions to run the script.

General Options
--version

Display the version information for the directory server.

-?, -H, --help

Display command-line usage information for the create-rc-script command.

Examples

The following examples show how to use the create-rc-script command. You can use the command on any UNIX, or Linux system that has at least the Java SE 5 (at least Sun version 1.5.0_08, preferably the latest version of Java SE 6) runtime environment installed on its target system.

For more information, see Directory Server System Requirements in Sun OpenDS Standard Edition 2.0 Installation Guide.

Example 1
Creating the Script

The following command generates the script to start, stop, and restart the directory server. It creates the file called myscript, specified by the -f option:

$ create-rc-script -f myscript
Example 2
Starting the Directory Server by Using the New Script

The following command uses the newly created script (see previous example) to start the directory server.

$ myscript start
Example 3
Stopping the Directory Server by Using the New Script

The following command uses the newly created script (see first example) to stop the directory server.

$ myscript stop
Example 4
Restarting the Directory Server by Using the New Script

The following command uses the newly created script (see first example) to restart the directory server.

$ myscript restart
Example 5
Specifying OPENDS_JAVA_HOME and OPENDS_JAVA_ARGS in the Script

The following command uses the -u (--userName), -j (--javaHome) and -J (--javaArgs) options.

$ create-rc-script -f myscript -u sysAdmin -j /usr/java -J "-Xms128m -Xmx128m"
Code Generated by the create-rc-script Command

The create-rc-script command from the example above generates the following code:

# /bin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at
# https://OpenDS.dev.java.net/OpenDS.LICENSE.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
# add the following below this CDDL HEADER, with the fields enclosed
# by brackets "[]" replaced with your own identifying information:
#      Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END

# Set the path to the OpenDS instance to manage
INSTANCE_ROOT="/usr/local/opends/standalone/ds-server-1"
export INSTANCE_ROOT

# Specify the path to the Java installation to use
OPENDS_JAVA_HOME="/usr/java"
export OPENDS_JAVA_HOME

# Specify arguments that should be provided to the JVM
JAVA_ARGS="-Xms128m -Xmx128m"
export JAVA_ARGS

# Determine what action should be performed on the server
case "${1}" in
start)
/bin/su sysAdmin "${INSTANCE_ROOT}/bin/start-ds" --quiet
exit ${?}
;;
stop)
/bin/su sysAdmin "${INSTANCE_ROOT}/bin/stop-ds" --quiet
exit ${?}
;;
restart)
/bin/su sysAdmin "${INSTANCE_ROOT}/bin/stop-ds" --restart --quiet
exit ${?}
;;
*)

echo "Usage:  $0 { start | stop | restart }"
exit 1
;;
esac
Exit Codes

An exit code of 0 indicates success. A non-zero exit code indicates that an error occurred.

Location

The create-rc-script command is located at this path:

UNIX and Linux: install-dir/bin/create-rc-script

Related Commands

start-ds

stop-ds