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"

Call 1-828-376-0458 to Work With Professionals Who Truly Understand FreeBSD

A-Team Systems is a proud supporter of the FreeBSD Foundation and many of our administrators are direct project contributors.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.