Atlassian Crowd startup script

Posted on 13 Oct, 2012 | 0 comments

Atlassian Crowd 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-crowd” in care puneti, folosind un editor, urmatorul continut:


#!/bin/sh
#
# atlassian-crowd Start/Stop the Atlassian Crowd Server
# chkconfig: 2345 80 05
# description: Atlassian Crowd Server
# Identity Management for Web Apps
#
# 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/CROWD/crowd-webapp/WEB-INF/classes/crowd-init.properties
# pidfile: /opt/CROWD/apache-tomcat/work/atlassian-crowd.pid
#
# Usage:
# /etc/init.d/atlassian-crowd {start|stop|kill|help}

#
# Variables
#
CROWD_USER="crowd"
CROWD_INSTALL="/opt/CROWD"
CROWD_HOME="/home/crowd/crowd-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=${CROWD_INSTALL}/apache-tomcat/work/atlassian-crowd.pid

#
# Functions
#
start_crowd() {
echo "Starting Atlassian Crowd Server: "
su - $CROWD_USER -c "cd ${CROWD_HOME}; export CATALINA_PID=${CATALINA_PID}; export JAVA_HOME=${JAVA_HOME}; ${CROWD_INSTALL}/apache-tomcat/bin/catalina.sh start"
echo -e "\tDone."
echo -e "\tYou can check the log file ${CROWD_HOME}/logs/atlassian-crowd.log for application startup details"
echo -e "\tand the log file ${CROWD_INSTALL}/apache-tomcat/logs/catalina.out for server startup details"
}
stop_crowd() {
echo "Shutting down Crowd: "
su - $CROWD_USER -c "cd ${CROWD_HOME}; export CATALINA_PID=${CATALINA_PID}; export JAVA_HOME=${JAVA_HOME}; ${CROWD_INSTALL}/apache-tomcat/bin/catalina.sh stop"
echo -e "\tDone."
echo -e "\tYou can check the log file ${CROWD_HOME}/logs/atlassian-crowd.log for application shutdown details"
echo -e "\tand the log file ${CROWD_INSTALL}/apache-tomcat/logs/catalina.out for server shutdown details"
}
kill_crowd() {
echo "Trying to force the shudown of application server: "
su - $CROWD_USER -c "cd ${CROWD_HOME}; export CATALINA_PID=${CATALINA_PID}; export JAVA_HOME=${JAVA_HOME}; ${CROWD_INSTALL}/apache-tomcat/bin/catalina.sh -force"
echo -e "\tYou can check the log file ${CROWD_HOME}/logs/atlassian-crowd.log for application shutdown details"
echo -e "\tand the log file ${CROWD_INSTALL}/apache-tomcat/logs/catalina.out for server shutdown details"
}
help_crowd() {
clear
echo "Atlassian Crowd rc-script"
echo -e "/etc/init.d/atlassian-crowd {start|stop|kill|help}\n"
echo "Options:"
echo "--------"
echo -e "start\tStarts the Atlassian Crowd server."
echo -e "stop\tStops the Atlassian Crowd server."
echo -e "kill\tStops the Atlassian Crowd 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_crowd
;;
stop)
stop_crowd
;;
kill)
kill_crowd
;;
help)
help_crowd
exit 0
;;
*)
echo "Usage: /etc/init.d/atlassian-crowd {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-crowd

 

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. Required fields are marked *

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