How to keep alive Jira and Confluence?

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 23, 2012

I have an instance of Jira that will always run out of memory after some time.

Does anyone has a good keep-alive daemon for it?

Note: it should be able to cope with human triggered restarts and manual shutdowns.

1 answer

1 vote
Radu Dumitriu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 23, 2012

Look, a quick and dirty script for you to start:

You will have to define some stuff in your env (JAVA_HOME, for instance) and register it in cron

#!/bin/bash

#
# This assumes Jira runs as root. If not proper sudo commands should be in place
#

JIRABIN_HOME=/opt/atlassian/jira5
JIRADAT_HOME=/opt/atlassian/jira5home

le=`grep "OutOfMemoryException" $JIRADAT_HOME/log/atlassian-jira.log | wc -l`
if [ "$le" != "0" ]
then
  pid=`cat $JIRABIN_HOME/work/catalina.pid`
  echo "Got exception, will act on pid $pid"
  $JIRABIN_HOME/bin/shutdown.sh
  sleep 30
  if [ -f $JIRADAT_HOME/.jira-home.lock ]
  then
    echo "Sorry, forced removal "
    kill -9 $pid
    rm -rf $JIRADAT_HOME/.jira-home.lock
    rm -rf $JIRABIN_HOME/work/catalina.pid
  fi
  if [ ! -d $JIRADAT_HOME/oldlogs ]
  then
    mkdir $JIRADAT_HOME/oldlogs
  fi
  mv $JIRADAT_HOME/log/*.log $JIRADAT_HOME/oldlogs/
  $JIRABIN_HOME/bin/startup.sh
fi

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 23, 2012

Thanks Radu, still this does not solve the problem. in 99% of the cases, the VM got stuck doing garbage collections when it runs out of memory, but the process is still running, so that's not the proper way of keeping jira alive.

Suggest an answer

Log in or Sign up to answer