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

Accepted Answer
0 votes

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

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
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

21,899 views 2 7
Join discussion

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