Jira: init.d script didn't seem to restart all services correctly

We've got a fresh install of Jira 5.1 on Redhat EL5.8. Last night the server was restarted but it seems tomcat wasn't fully working. It just showed the following until I manually shut it down and started it up again...

Has anyone one seen this before? I've not touched anything, it's a fresh install. Here's the script in question...

$ cat /etc/init.d/jira
#!/bin/bash

# JIRA Linux service controller script
cd "/u01/jira/application/bin"

case "$1" in
    start)
        ./start-jira.sh
        ;;
    stop)
        ./stop-jira.sh
        ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
        ;;
esac

Looking at start-jira.sh, it should be switching to the jira user via user.sh.

Actually, it's occuring to me perhaps this is due to jira trying to start up before the database has managed to come online. It's a big fat Oracle instance, so it takes a while. Does that seem like it could be the culprit? If so, what's the best way to fix this?

2 answers

1 accepted

Finally got a chance to look at the logs. Certainly Jira tried to start up while the database was not yet ready and failed.

The problem has been fixed, our DBA added chkconfig support to the default init.d script and removed the existing symlinks. After adjusting the priority of the Jira script so that it starts after Oracle now it's all good.

This is suitable replacement script for jira on Redhat based servers (just update BASE=/path/to/jira):

#!/bin/bash
#
# JIRA startup script
# chkconfig: 345 99 05
# description: Jira Start/Stop Service Script

#Source function library.
. /etc/init.d/functions


# 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=/path/to/jira
# Location of startup/shutdown logfile
LOGFILE=/var/log/jira/jira.log

start() {
initlog -c "echo -n Starting Jira:      " >>$LOGFILE 2>&1
/bin/su -m $USER -c "cd $BASE/logs && $BASE/bin/start-jira.sh &> /dev/null" >>$LOGFILE 2>&1
}

stop() {
initlog -c "echo -n Stopping Jira:      " >>$LOGFILE 2>&1
/bin/su -m $USER -c "$BASE/bin/shut-jira.sh &> /dev/null" >>$LOGFILE 2>&1
}
 
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload|condrestart)
        stop
	sleep 10
        start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac

0 vote
Colin Goudie Community Champion Jul 25, 2012

Check out the log files for the culprit. If it's oracle then surely they'd be jdbc errors in the logs

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published 6 hours ago in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

86 views 4 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you