jira startup script in /etc/init.d fails

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
Chris Fuller Atlassian Team Apr 07, 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.

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

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?

 

Chris Fuller Atlassian Team Apr 08, 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.

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

Chris Fuller Atlassian Team Apr 08, 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.

OK. Thanks for all the details.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

440 views 7 5
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