Jira service not auto-starting when installed as a service

Jason Kovacs June 4, 2018

I installed Jira Server 7.9.2 on Ubuntu 18.04 LTS.  During installation, ran with sudo and chose Yes for 'Install JIRA as Service?'. Expected Jira to start automatically on server reboot, but it does not.

Unable to run 'sudo update-rc.d jira enable' since the /etc/init.d/jira script that was installed does not support runlevels, but is a simplistic script that supports only start and stop operations.

Found the article Starting JIRA Automatically on Linux, but expected the Jira Installation process to do this automatically, setting paths in the script and setting it up to run on reboot.

Should the Jira Installation have set this up automatically as indicated?  Is this a bug in the installer or for my particular configuration, or am I expected to follow that supplemental article after installation?

6 answers

14 votes
Brandon M Jackson June 1, 2019

Came across this today as well. (Jira version 8.2, Ubuntu 19) Here is a workaround I was able to come up with derived from the bamboo installation instructions.

 

After Installing jira. Make note of the start/stop script locations from /etc/init.d/jira

First stop the jira service if it is already running.

Now create file with preferred method. I used:

sudo nano /etc/systemd/system/jira.service

 

File contents:

[Unit]
Description=Atlassian Jira
After=syslog.target network.target

[Service]
Type=forking
User=jira
ExecStart=/opt/atlassian/jira/bin/start-jira.sh
ExecStop=/opt/atlassian/jira/bin/stop-jira.sh
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target 

Note: ExecStart and ExecStop will be the path to your jira start/stop script. Be sure to change if different.

Next remove or move the original init.d file somewhere else for safe keeping, it shall no longer be needed.

sudo mv /etc/init.d/jira /path/to/wherever

Note: Change /path/to/wherever to a valid path

Next enable the service

sudo systemctl enable jira

Then start if you haven't already

sudo systemctl start jira 
Prasad Thiriveedi June 25, 2019

Thanks. It works.

Like Jon Wainman likes this
norm todd August 15, 2019

This is awesome - worked beautifully for confluence on ubuntu 18.4.3

Mat_Chavez August 16, 2019

Just did this, and it's *&^$&^ brilliant. Well done mate.

Why Atlassian can't get this figured out is beyond me.

Mat_Chavez August 16, 2019

Can someone confirm that this was all fixed in 8.3, and is no longer necessary?

Soporte Excentia October 10, 2019

Thank you Brandon. It works.

OpOnion July 25, 2020

works perfectly on ubuntu 20.04

4 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 4, 2018

It appears this is a known bug.  More details in https://jira.atlassian.com/browse/JRASERVER-42000

There is also a related documentation request to update our docs, as it does not appear that Atlassian has provided a clear set of steps to use this with systemd: https://jira.atlassian.com/browse/JRASERVER-63191

I am going to go back and review other support cases on this, because I agree with you, this seems like something the Jira installation package should be able to do out of the box.

In the meantime, I found a related thread in https://community.atlassian.com/t5/Jira-questions/CentOS-7-systemd-startup-scripts-for-Jira-Fisheye/qaq-p/157575 that might be useful for configuring this.

Jason Kovacs June 4, 2018

Thanks for the quick reply.  I did find that old Bug report from Feb 2015 also.

A comment near the bottom from Alexis Huxley in 2017 helped me, which no other solution did that I attempted using systemd service scripts.

There is a simple fix that Atlassian could make to the existing shell scripts provided in the installer that create /etc/init.d/jira and /etc/init.d/confluence scripts.

File: /etc/init.d/jira

#!/bin/bash
### BEGIN INIT INFO
# Provides: jira
# Required-Start: $network $local_fs $syslog
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: JIRA Server
# Description: JIRA Server
### END INIT INFO
...

File: /etc/init.d/confluence

#!/bin/bash
### BEGIN INIT INFO
# Provides: confluence
# Required-Start: $network $local_fs $syslog
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Confluence Server
# Description: Confluence Server
### END INIT INFO
...

With these new comment lines, I was able to run the following systemd commands:

$> sudo systemctl enable jira
jira.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable jira

$> sudo systemctl enable confluence
confluence.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable confluence

This change allowed me to enable the jira and confluence service scripts as is, without having to create new systemd service configuration files.  Finally, those services started automatically on system start.

Prior to adding the comment lines above after #!/bin/bash, I would get the error on enable service, which prevented the bash script from loading with systemd:

$> sudo systemctl enable jira
jira.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable jira
update-rc.d: error: jira Default-Start contains no runlevels, aborting.

$> sudo systemctl enable confluence
confluence.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable confluence
update-rc.d: error: confluence Default-Start contains no runlevels, aborting.

If you are going to look into accelerating this bug report again, consider patching the System V init scripts with the above comments, or whatever Atlassian sees fit, so that the installation is not broken for systemd users, until full systemd service configuration scripts are provided and the installation process changed.

Like # people like this
David Patterson January 3, 2019

I was surprised to see that with Jira ver 7.13 this is still a problem.

Thank you Janos Kovacs for your writeup this gave me a quick fix.

CingleVue Admin February 20, 2019

...

1 vote
Jason Kovacs June 4, 2018

As a follow up, I learned that Ubuntu since 15.04 uses systemd instead of init or upstart.  The official Atlassian article I linked above is written for System V init scripts only, not systemd.

The Jira and Confluence installers surely should detect this and install the appropriate start-up script, so I would consider this a bug in the installation process.  Is there any official documentation on this problem or solutions for Jira?

I found a related Atlassian article for Confluence on systemd:  Run Confluence as a systemd service on linux

Also found an unofficial blog post on the subject for Jira and Confluence:  JIRA & Confluence with systemd on CentOS

So, I will attempt to adapt each of these articles to work for Jira on Ubuntu using systemd.

Still it seems like this should be supported out of the box for one of the major Linux distros and one of the top 3 system managers.

0 votes
Andrey Lezhnin January 13, 2020

Thank you Brandon. It works. on JIRA 8.6.1 and Ubuntu 19.10.

0 votes
Matthias Wiora May 31, 2019

@ ATLASSIAN: guys..... Jira Version 8.1.0 and this bug still persists. Please add this small change to your backlog and make an admin-friendly experience possible... At the moment Jira and Confluence seems to be developed by two different companies... no fun.

Mat Chavez June 19, 2019

8.2.2 still, unter 18.04.

Ali January 29, 2020

It still a problem with 8.6.1 with ubuntu 18.04

 

Thanks Brandon!

0 votes
spectaculair January 2, 2019

Thank you Jason Kovacs, you helped me a lot!

Suggest an answer

Log in or Sign up to answer