Atlassian CONFLUENCE startup script

Posted on 14 Oct, 2012 | 0 comments

Atlassian CONFLUENCE startup script

 

Pentru cei interesati de o solutie pentru sisteme de operare care ruleaza CentOS, RHEL, Fedora, mai jos sunt citiva pasi:

 

1. Drepturile de acces la anumite fisiere si directoare trebuiesc actualizate

 

2. Creati in /etc/init.d un fisier “atlassian-confluence” in care puneti, folosind un editor, urmatorul continut:


#!/bin/sh
#
# atlassian-confluence Start/Stop the Atlassian Confluence Server
# chkconfig: 2345 80 05
# description: Atlassian Confluence Server
# Bring Teams Together, Online
#
# Written by Vasile Strugaru
# Inspired by Atlassian documentation
#
# contact@vasile.strugaru.ro
# http://vasile.strugaru.ro
#
# Please check your install folders and change accordingly the necessary info
#
# processname: java
# config: /opt/CONFLUENCE/confluence/WEB-INF/classes/confluence-init.properties
# pidfile: /opt/CONFLUENCE/work/atlassian-confluence.pid
#
# Usage:
# /etc/init.d/atlassian-confluence {start|stop|kill|help}

#
# Variables
#
CONFLUENCE_USER="confluence"
CONFLUENCE_INSTALL="/opt/CONFLUENCE"
CONFLUENCE_HOME="/home/confluence/confluence-home"

# JAVA_HOME Must point at your Java Development Kit installation.
# Required to run the with the "debug" argument.
#
# JRE_HOME Must point at your Java Development Kit installation.
# Defaults to JAVA_HOME if empty.
JAVA_HOME=/opt/jdk1.6.0_30

# CATALINA_PID (Optional) Path of the file which should contains the pid
# of catalina startup java process, when start (fork) is used
CATALINA_PID=${CONFLUENCE_INSTALL}/work/atlassian-confluence.pid

#
# Functions
#
#
# Functions
#
start_confluence() {
echo "Starting Atlassian Confluence Server: "
su - $CONFLUENCE_USER -c "cd ${CONFLUENCE_HOME}; export CATALINA_PID=${CATALINA_PID}; export JAVA_HOME=${JAVA_HOME}; ${CONFLUENCE_INSTALL}/bin/catalina.sh start"
echo -e "\tDone."
echo -e "\tYou can check the log file ${CONFLUENCE_HOME}/logs/atlassian-confluence.log for application startup details"
echo -e "\tand the log file ${CONFLUENCE_INSTALL}/logs/catalina.out for server startup details"
}
stop_confluence() {
echo "Shutting down Confluence: "
su - $CONFLUENCE_USER -c "cd ${CONFLUENCE_HOME}; export CATALINA_PID=${CATALINA_PID}; export JAVA_HOME=${JAVA_HOME}; ${CONFLUENCE_INSTALL}/bin/catalina.sh stop"
echo -e "\tDone."
echo -e "\tYou can check the log file ${CONFLUENCE_HOME}/logs/atlassian-confluence.log for application shutdown details"
echo -e "\tand the log file ${CONFLUENCE_INSTALL}/logs/catalina.out for server shutdown details"
}
kill_confluence() {
echo "Trying to force the shudown of application server: "
su - $CONFLUENCE_USER -c "cd ${CONFLUENCE_HOME}; export CATALINA_PID=${CATALINA_PID}; export JAVA_HOME=${JAVA_HOME}; ${CONFLUENCE_INSTALL}/bin/catalina.sh -force"
echo -e "\tYou can check the log file ${CONFLUENCE_HOME}/logs/atlassian-confluence.log for application shutdown details"
echo -e "\tand the log file ${CONFLUENCE_INSTALL}/logs/catalina.out for server shutdown details"
}
help_confluence() {
clear
echo "Atlassian CONFLUENCE rc-script"
echo -e "/etc/init.d/atlassian-confluence {start|stop|kill|help}\n"
echo "Options:"
echo "--------"
echo -e "start\tStarts the Atlassian Confluence server."
echo -e "stop\tStops the Atlassian Confluence server."
echo -e "kill\tStops the Atlassian Confluence server, wait up to 5 seconds and then use kill -KILL if still running"
echo -e "help\tShow this message.\n"
echo "Note:"
echo "--------"
echo -e "\tUsing the kill option require that \$CATALINA_PID is defined\n"
}
case "$1" in
start)
start_confluence
;;
stop)
stop_confluence
;;
kill)
kill_confluence
;;
help)
help_confluence
exit 0
;;
*)
echo "Usage: /etc/init.d/atlassian-confluence {start|stop|kill|help}"
exit 1
;;
esac

 

3. Legaturile simbolice pentru rularea automata la pornirea si oprirea sistemului se fac prin comanda:


>sudo /sbin/chkconfig --add atlassian-confluence

 

Informatiile necesare pentru chkconfig se afla la inceputul scriptului.

 

Info

Pentru un sistem ce utilizeaza “System V”avem:

Runlevel 0: Shuts down the system (Halt)

Runlevel 1: Single user mode (super user)

Runlevel 2: Multi user

Runlevel 3: Multi user + network

Runlevel 4: Not used/User-definable

Runlevel 5: As runlevel 3 + display manager

Runlevel 6: Reboots the system

 

Leave a Comment

Your email address will not be published.

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