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

Sam Hall
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 25, 2012

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

0 votes
Answer accepted
Sam Hall
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.
August 14, 2012

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 votes
Colin Goudie
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 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