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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,342 views 14 20
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot