OpenDJ init script for FreeBSD

With help from the inimitable Chris Ridd of ForgeRock.

The basic layout is Chris’s, my contribution was to add back in ForgeRock’s copyright notice and a “restart” routine that may or may not be a good idea.

Tested with OpenDJ 2.6.0 and OpenJDK 8 on FreeBSD 10.

#!/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
# trunk/opends/resource/legal-notices/CDDLv1_0.txt
# or http://forgerock.org/license/CDDLv1.0.html.
# 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/CDDLv1_0.txt. 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]
# PROVIDE: opendj
# REQUIRE: LOGIN
# KEYWORD: shutdown

. /etc/rc.subr

name="opendj"
rcvar=opendj_enable

start_cmd="${name}_start"
stop_cmd="${name}_stop"
restart_cmd="${name}_restart"

load_rc_config ${name}
: ${opendj_enable:=no}
: ${opendj_msg="OpenDJ not started."}

INSTALL_ROOT=/usr/local/opendj
export INSTALL_ROOT

opendj_start()
{
/usr/bin/su opendj -c ${INSTALL_ROOT}/bin/start-ds
}

opendj_stop()
{
/usr/bin/su opendj -c ${INSTALL_ROOT}/bin/stop-ds
}

opendj_restart()
{
/usr/bin/su opendj -c ${INSTALL_ROOT}/bin/stop-ds
sleep 30
/usr/bin/su opendj -c ${INSTALL_ROOT}/bin/start-ds
}

run_rc_command "$1"

This entry was posted in Directory, System Administration on by .

About phil

My name is Phil Lembo. In my day job I’m an enterprise IT architect for a leading distribution and services company. The rest of my time I try to maintain a semi-normal family life in the suburbs of Raleigh, NC. E-mail me at philipATlembobrothersDOTcom. The opinions expressed here are entirely my own and not those of my employers, past, present or future (except where I quote others, who will need to accept responsibility for their own rants).