0N/A#! /bin/sh
3909N/A#
0N/A# OPENDJ SERVICE SCRIPT
0N/A#
0N/A
0N/A#
2362N/A# CDDL HEADER START
0N/A#
2362N/A# The contents of this file are subject to the terms of the
0N/A# Common Development and Distribution License, Version 1.0 only
0N/A# (the "License"). You may not use this file except in compliance
0N/A# with the License.
0N/A#
0N/A# You can obtain a copy of the license at
0N/A# trunk/opendj3/legal-notices/CDDLv1_0.txt
0N/A# or http://forgerock.org/license/CDDLv1.0.html.
0N/A# See the License for the specific language governing permissions
0N/A# and limitations under the License.
0N/A#
0N/A# When distributing Covered Code, include this CDDL HEADER in each
2362N/A# file and include the License file at
2362N/A# trunk/opendj3/legal-notices/CDDLv1_0.txt. If applicable,
2362N/A# add the following below this CDDL HEADER, with the fields enclosed
0N/A# by brackets "[]" replaced with your own identifying information:
0N/A# Portions Copyright [yyyy] [name of copyright owner]
0N/A#
0N/A# CDDL HEADER END
0N/A#
4151N/A# Copyright 2013 ForgeRock AS
0N/A#
0N/A
0N/A
0N/A# chkconfig: 2345 80 05
0N/A# description: Starts and stops opendj LDAPv3 service.
0N/A#
0N/A### BEGIN INIT INFO
0N/A# Provides: opendj
0N/A# Required-Start:
3731N/A# Required-Stop:
0N/A# Default-Start: 2 3 4 5
0N/A# Default-Stop: 0 1 6
0N/A# Short-Description: This is the opendj daemon
0N/A# Description: OpenDJ is an LDAPv3 compliant directory service, developed for the Java
0N/A# platform, providing a high performance, highly available and secure store
0N/A# for the identities managed by enterprises. Its easy installation process,
0N/A# combined with the power of the Java platform makes OpenDJ one of the
0N/A# simplest and fastest directory servers to deploy and manage.
0N/A### END INIT INFO
0N/A
0N/A# Set up source function library depending on the distribution
0N/Aif [ -f /etc/redhat-release ]
0N/Athen
0N/A # Redhat
0N/A . /etc/init.d/functions
0N/Aelif [ -f /etc/SuSE-release ]
0N/Athen
0N/A # SuSE
0N/A . /etc/rc.status
0N/Aelif [ -f /etc/lsb-release ]
0N/Athen
0N/A # Debian
0N/A . /lib/lsb/init-functions
0N/Aelse
0N/A # Other dist.
0N/A if [ -f /etc/init.d/functions.sh ]
0N/A then
0N/A . /etc/init.d/functions.sh
0N/A fi
0N/Afi
0N/A
0N/A
0N/A# Sets the script vars
0N/AINSTALL_ROOT="/opt/opendj/"
0N/Aexport INSTALL_ROOT
0N/ADAEMON=opendj
0N/A# Original PID file
0N/AORIGINPIDFILE=/opt/opendj/logs/server.pid
0N/A# Pid file is a symlink to /opt/opendj/log/server.pid
0N/APIDFILE=/var/run/opendj.pid
0N/ARETVAL=0
0N/A
0N/A# If the daemon is not there, then exit / LSB return code.
0N/Atest -x "$INSTALL_ROOT/bin/start-ds" || exit 5
0N/A
0N/A# /var/run is deleted after reboot (eg. debian)
0N/A# recreates the symlink if needed.
0N/Atest -h "$PIDFILE" || ln -s $ORIGINPIDFILE $PIDFILE
0N/A
0N/A#Starts the server and creates pid file.
0N/Astart() {
0N/A echo -n $"Starting $DAEMON: "
0N/A # Server is running
0N/A if [ -e $PIDFILE ]
0N/A then
0N/A echo "> Already running."
0N/A return 0
0N/A else
0N/A "$INSTALL_ROOT"/bin/start-ds --quiet
0N/A RETVAL=$?
0N/A if [ $RETVAL = 0 ]
0N/A then
0N/A echo "> SUCCESS."
0N/A else
0N/A echo "> FAILURE."
0N/A fi
0N/A echo ""
0N/A return $RETVAL
0N/A fi
0N/A}
0N/A
0N/A#Stops the server and removes pid file.
0N/Astop() {
0N/A echo -n $"Stopping $DAEMON: "
0N/A # Server is running
0N/A if [ -e $PIDFILE ]
0N/A then
0N/A "$INSTALL_ROOT"/bin/stop-ds --quiet
0N/A RETVAL=$?
0N/A if [ $RETVAL = 0 ]
0N/A then
0N/A echo "> SUCCESS."
0N/A else
0N/A echo "> FAILURE."
0N/A fi
0N/A echo ""
0N/A return $RETVAL
0N/A else
0N/A echo "> Already stopped."
0N/A echo ""
0N/A return 3
0N/A fi
0N/A}
0N/A
0N/A# Displays the service status
0N/Astatus() {
0N/A echo -n $"$DAEMON status: "
0N/A if [ -e $PIDFILE ]
0N/A then
0N/A echo "> Running."
0N/A return 0
0N/A else
0N/A echo "> Stopped."
0N/A return 3
0N/A fi
0N/A}
0N/A
0N/Acase "$1" in
0N/A start)
0N/A start
2147N/A ;;
2147N/A stop)
0N/A stop
0N/A ;;
0N/A restart)
0N/A stop
0N/A sleep 5
0N/A start
0N/A ;;
0N/A force-reload)
0N/A # Not implemented.
0N/A ;;
0N/A status)
0N/A status
0N/A ;;
0N/A *)
0N/A echo $"Usage: /etc/init.d/$DAEMON {start|restart|stop|force-reload|status}"
0N/A exit 1
0N/A ;;
0N/Aesac
243N/A
0N/Aexit $RETVAL
0N/A