/////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
# /the/tech/blog
Solutions for FreeBSD web and application servers using PHP, mySQL, Apache and more.
Posted By Adam
Saturday, August 21st 2010

Adam StrohlHOWTO: FreeBSD rc.d Script for Atlassian Confluence

Below is a simple but effective script to bring Atlassian Confluence under control of FreeBSD's rc.d script system. This is designed for Confluence in standalone configuration, ie; with its own dedicated Tomcat instance.

This script allows you to enable Confluence, and when enabled it will start up with your server (after Apache HTTP and MySQL has started up). You may wish to remove the 'apache' package from the REQUIRE line if you don't use Apache to wrap over Tomcat.

It will also gracefully shutdown before the system, and supports the status and restart options as well.


#!/bin/sh
#
# Atlassian Confluence Startup / Shutdown Control
# ------------------------------------------------- -
#
# Copyright 2010 (c) by A-Team Systems
# http://www.ateamsystems.com/
#
# Licensed under the BSD License - Free Use For All
#

# PROVIDE: confluence
# REQUIRE: DAEMON apache mysql
# BEFORE: LOGIN
# KEYWORD: shutdown

#
# To activate define confluence_enable="YES" in /etc/rc.conf
#

# ADJUST TO YOUR JDK PATH
#
JAVA_HOME="/usr/local/jdk1.6.0";
JRE_HOME="/usr/local/jdk1.6.0/jre";

# ADJUST TO YOUR CONFLUENCE ROOT
#
confluence_root="/usr/local/confluence"

#
# END ADJUSTMENTS
#
CATALINA_PID="/var/run/confluence.pid"
export JAVA_HOME
export JRE_HOME
export CATALINA_PID

. /etc/rc.subr

name="confluence"
rcvar=${name}_enable
confluence_enable="${confluence_enable-NO}"

procname="java"
pidfile="/var/run/confluence.pid"

start_postcmd="${name}_start"

confluence_start()
{
#
# Use the provided atlassian scripts to start Confluence
#

${confluence_root}/bin/catalina.sh start || err 1 "Error triggering Confluence start up"
}


load_rc_config $name

run_rc_command "$1"

Hopefully this saves you some time as I figure everyone running Atlassian Confluence under FreeBSD probably wants this. I suggest placing the above script in a file called /usr/local/etc/rc.d/confluence.sh and then chmod 755ing it.

Note: You need to enable Confluence in your /etc/rc.conf to have it start up automatically:

confluence_enable="YES"

loading icon

Fetching vote status, one moment ...

Add a Comment:

* Name:
* Email address:
Verification purposes only. Your email address will not be shown publicly, transfered, or sold. We don't spam and take data privacy seriously.
* Comment:
icon

Related Experience

Take a look at these related items:

FreeBSD® Admin. & Security

icon

Disclaimer

Any problems and their solutions discussed here are designed to be examples and may not exactly match your situation.

No warranty is provided or implied with these articles, if it's critical contact us: we support and guarantee all of our work.