Linux において JIRA を自動的に起動する方法
Linux/Solaris のシステム管理は、アトラシアンのサポート対象外です。本ページはあくまで情報提供のみを目的としています。
Linux/Solaris におけるベストプラクティスは、必要な権限のみを持つ専用ユーザとして各サービス (JIRA を含む) のインストール、構成および実行を行う事です。
Linux/Solaris における JIRA のインストール、構成、および自動的な起動方法:
Create a
jira
user account which will be used to run JIRA. For example, enter the following at a Linux/Solaris console:sudo useradd --create-home -c "JIRA role account" jira
JIRA がインストールされるディレクトリを作成します。例:
sudo mkdir /opt/atlassian/jira sudo chown jira: /opt/atlassian/jira
Log in as the
jira
user to install JIRA:sudo su - jira
Assuming you downloaded the JIRA from a 'tar.gz' archive, you need to extract it:
cd /opt/atlassian/jira tar zxvf /tmp/atlassian-jira-X.Y.tar.gz ln -s atlassian-jira-X.Y/ current
- Edit
current/atlassian-jira/WEB-INF/classes/jira-application.properties
and setjira.home=/var/atlassian/application-data/jira
Then back as root, create the file
/etc/init.d/jira
(code shown below), which will be responsible for starting up JIRA after a reboot (or when manually invoked).#!/bin/sh -e # JIRA startup script #chkconfig: 2345 80 05 #description: JIRA # Define some variables # Name of app ( JIRA, Confluence, etc ) APP=jira # Name of the user to run as USER=jira # Location of application's bin directory BASE=/opt/atlassian/jira/current # Location of Java JDK export JAVA_HOME=/usr/lib/jvm/java-6-sun case "$1" in # Start command start) echo "Starting $APP" /bin/su -m $USER -c "cd $BASE/logs && $BASE/bin/startup.sh &> /dev/null" ;; # Stop command stop) echo "Stopping $APP" /bin/su -m $USER -c "$BASE/bin/shutdown.sh &> /dev/null" echo "$APP stopped successfully" ;; # Restart command restart) $0 stop sleep 5 $0 start ;; *) echo "Usage: /etc/init.d/$APP {start|restart|stop}" exit 1 ;; esac exit 0
初期化スクリプトを実行可能にします:
chmod \+x /etc/init.d/jira
- シンボリックリンクをランレベルのディレクトリに配置し、このスクリプトの開始と停止を自動的に行えるようにします。
Debian ベースのシステムの場合:
update-rc.d jira defaults
上記のコマンドを実行する事で、シンボリックリンクをランレベルのディレクトリに配置します:
Adding system startup for /etc/init.d/jira ... /etc/rc0.d/K20jira -> ../init.d/jira /etc/rc1.d/K20jira -> ../init.d/jira /etc/rc6.d/K20jira -> ../init.d/jira /etc/rc2.d/S20jira -> ../init.d/jira /etc/rc3.d/S20jira -> ../init.d/jira /etc/rc4.d/S20jira -> ../init.d/jira /etc/rc5.d/S20jira -> ../init.d/jira
RedHat ベースのシステムの場合:
init.d スクリプトに chkconfig 設定が含まれています
sudo /sbin/chkconfig --add jira
- スクリプトが正しい順序で実行されるようにします (特にデータベースの起動スクリプトの後に実行されるように)。
情報を提供して頂きありがとうございました
Thank you to Matthew Block and Pete Toscano for the original comments that we based this information on.