jira startup script in /etc/init.d fails

g_vindi April 7, 2015

Hello,

 

I've installed JIRA and everything was smooth. enabled automatic start and hence the install of the JIRA startup script in /etc/init.d

But it seems when it runs it fails. when I manually start JIRA using catalina.sh it works fine - JIRA starts up and I can access the web console.

 

I tried to manually execute start/stop (service JIRA stop, service JIRA start) and I get below error.

=========================

root@vindika-lubantu:~# service jira start

 

To run JIRA in the foreground, start the server with start-jira.sh -fg

executing using dedicated user: jira

./catalina.sh: 1: cd: can't cd to ./..

Cannot find /opt/atlassian/jira/bin/bin/setclasspath.sh

This file is needed to run this program

root@vindika-lubantu:~# 

=========================

 

Now here I'm not sure why catalina.sh is looking for this 'bin/bin' path. maybe CATALINA_BASE is not set properly. I'm a bit loss here as I'm new to JIRA. Can someone please help?

PS: I'm running JIRA on a VM and I also have Confluence installed in the same VM.

 

2 answers

1 vote
crf
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 7, 2015

catalina.sh assumes that you are in the bin directory when you run it, but the init.d script is running with root as the current directory.  You need to either set CATALINA_HOME or cd into the bin directory before running the script.  Safest/easiest is to create your own wrapper script in init.d rather than trying to use catalina.sh there directly.  It might look something like:

 

#!/bin/sh -e
cd "/opt/atlassian/jira/bin"
exec ./start-jira.sh "$@"

Edit: Originally said to run catalina.sh, but as that skips the su command that switches to the dedicated JIRA user, that has security concerns.  The start-jira.sh script is the correct one to use.

g_vindi April 7, 2015

That makes sense. Thanks Chris! I'll try what you suggested. Cheers

0 votes
g_vindi April 8, 2015

The script worked! 

but I tried something else as well.

I changed owner of /opt/atlassian/JIRA folder to jira:JIRA user and now the default init script is working as well.

It this because the init script tries to start JIRA using the default jira:JIRA user?

 

crf
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 8, 2015

init.d scripts run as root on most systems. Running as root is, of course, not recommended. start-jira.sh takes care of changing to the appropriate user before running catalina.sh, and my answer really ought to instruct you to run that instead of running catalina.sh directly. If the "jira" user did not have access to these directories, then the "cd" that it tries to do while looking for where JIRA has been installed would probably fail, after which point it would just be confused. Changing the directories to the jira user and running start-jira.sh is probably a better answer.

g_vindi April 8, 2015

thanks! so if I'm running the installer bin file, should I execute it as a non root user?

crf
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 8, 2015

@Vindika Dissanayake: The correct way to run the installer is documented here: https://confluence.atlassian.com/display/JIRA/Installing+JIRA+on+Linux#InstallingJIRAonLinux-1.DownloadandInstalltheJIRA'LinuxInstaller'; You may run this as root. It will guide you through creating a user especially for JIRA's use so that it will not be running as root when it starts, but root's privileges are needed to create that user, so it is actually recommended that you use root for the actual installation.

g_vindi April 9, 2015

OK. Thanks for all the details.

Suggest an answer

Log in or Sign up to answer