Start Jira applications automatically in Linux

Still need help?

The Atlassian Community is here for you.

Ask the community

Linux/Solaris system administration is outside the scope of Atlassian support. This page is provided for your information only.

For Linux distributions that are utilizing systemd (such as RHEL 7 or later) instead of SysVinit, refer to this page instead.

How to identify whether the OS is utilizing systemd or SysVinit:

Both systemd and SysVinit always has process ID of "1", run the following to show the process details:

ps --no-headers -o comm 1

SysVinit example:

[root@test ~]#  ps --no-headers -o comm 1

systemd example:

[root@test ~]#  ps --no-headers -o comm 1

On Linux/Solaris, the best practice is to install, configure and run each service (including JIRA) as a dedicated user with only the permissions they require.

To install, configure and get JIRA to start automatically on Linux/Solaris:

  1. Create a jira user account which will be used to run JIRA. For example, enter the following at a Linux/Solaris console:

    sudo useradd --create-home -c "JIRA role account" jira
  2. Create a directory into which JIRA will be installed. For example:

    sudo mkdir /opt/atlassian/jira
    sudo chown jira: /opt/atlassian/jira
  3. Log in as the jira user to install JIRA:

    sudo su - jira
  4. Assuming you downloaded the JIRA from a 'tar.gz' archive, you need to extract it:

    cd /opt/atlassian/jira
    tar zxvf /tmp/atlassian-jira-X.Y.tar.gz
    ln -s atlassian-jira-X.Y/ current
  5. Edit current/atlassian-jira/WEB-INF/classes/ and set jira.home=/var/atlassian/application-data/jira
  6. Then back as root, create the file /etc/init.d/jira (code shown below), which will be responsible for starting up JIRA after a reboot (or when manually invoked).

    #!/bin/sh -e
    # JIRA startup script
    #chkconfig: 2345 80 05
    #description: JIRA
    # Define some variables
    # Name of app ( JIRA, Confluence, etc )
    # Name of the user to run as
    # Location of application's bin directory
    # Location of Java JDK
    export JAVA_HOME=/usr/lib/jvm/java-6-sun
    case "$1" in
      # Start command
        echo "Starting $APP"
        /bin/su -m $USER -c "cd $BASE/logs && $BASE/bin/ &> /dev/null"
      # Stop command
        echo "Stopping $APP"
        /bin/su -m $USER -c "$BASE/bin/ &> /dev/null"
        echo "$APP stopped successfully"
       # Restart command
            $0 stop
            sleep 5
            $0 start
        echo "Usage: /etc/init.d/$APP {start|restart|stop}"
        exit 1
    exit 0
  7. Make the init script executable:

    chmod \+x /etc/init.d/jira
  8. Place symlinks in the run-level directories to start and stop this script automatically.

    1. For Debian-based systems:

      update-rc.d jira defaults

      The following commands will be executed to place symlinks in the run-level directories:

      Adding system startup for /etc/init.d/jira ...
         /etc/rc0.d/K20jira -> ../init.d/jira
         /etc/rc1.d/K20jira -> ../init.d/jira
         /etc/rc6.d/K20jira -> ../init.d/jira
         /etc/rc2.d/S20jira -> ../init.d/jira
         /etc/rc3.d/S20jira -> ../init.d/jira
         /etc/rc4.d/S20jira -> ../init.d/jira
         /etc/rc5.d/S20jira -> ../init.d/jira
    2. For RedHat-based systems:

      tip/resting Created with Sketch.

      the init.d script contains chkconfig settings

      sudo /sbin/chkconfig --add jira
  9. Ensure the script is executed in the correct order, in particular after the database startup script.

Thank you for this information

Thank you to Matthew Block and Pete Toscano for the original comments that we based this information on.

Last modified on Sep 1, 2020

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.