Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

For long-term use, JIRA should be configured to automatically restart when the operating system restarts. For Windows servers, this means configuring JIRA to run as a Windows service.

(info) If you are running JIRA Standalone on Linux and want to start it automatically, please refer to Starting JIRA Standalone automatically on Linux instead.

Running JIRA as a Windows service has other advantages. When started manually a console window opens, and there is a risk of someone accidentally shutting down JIRA by closing this. Also, the JIRA logs are properly managed by the Windows service (found in logs\stdout*.log in your JIRA Home Directory, and rotated daily).

There are two ways to install JIRA as a service: via the installer, and manually.

On this page:

Table of Contents
minlevel2

Installing JIRA as a Service

Installing as a Service with the Installer

The easiest way to get JIRA installed as a Windows service is by clicking the 'Install JIRA as Service' check box when running the Windows installer:

Note

You will need full Administrator rights on your Windows operating system for this installation process to complete successfully.

Installing as a Service manually

If you didn't use the Windows installer, or for some other reason have JIRA Standalone and now want it to run as a service, follow these instructions. They apply only to JIRA running in the Apache Tomcat application server (e.g. the JIRA "Standalone" distribution).

Info

If you are running a 64-bit version of Windows, please note that Apache Tomcat cannot run as a Windows service if you are using a 64-bit JDK/JRE (see JRA-12965). Please ensure that you are using a 32-bit JDK/JRE.

If you used the Windows Installer, a 32-bit JDK will already have been installed for you.

Info

On any Windows operating system with User Account Control (UAC) such as Windows Vista or Windows 7, you must either disable UAC or run 'cmd.exe' as an administrator (e.g. by right-clicking on 'cmd.exe' and selecting "Run as administrator") in order to execute the script below.

If UAC is enabled, simply logging in to Windows with an Administrator account will not be sufficient.

  1. Open a DOS prompt,
  2. 'cd' to the JIRA Standalone directory, and then the *bin* subdirectory
  3. If a directory in the path has spaces (e.g. 'C:\Program Files\..'), please convert it to its eight-character equivalent (e.g. c:\Progra~1\..).
  4. Ensure the JAVA_HOME variable is set to the JDKbase directory, with echo %JAVA_HOME%.
  5. Run the following command:
    Code Block
    service.bat install JIRA
    Here is a screenshot of the process:

    JIRA should now be installed as a service.
  6. In addition, to have the JIRA service start automatically when the server starts, run:
    Code Block
    tomcat6 //US//JIRA --Startup auto
    The JIRA service will automatically start up the next time the server reboots. The JIRA service can be manually started with the command 'net start JIRA' and stopped with 'net stop JIRA'.
    Info

    To see what parameters the JIRA service is starting with, Go to Start -> Run, and run "regedt32.exe".
    For Windows 32 bit edition navigate to HKEY_LOCAL_MACHINE -> SOFTWARE -> Apache Software Foundation -> Procrun 2.0 -> JIRA<time stamp>
    For Windows 64 bit edition navigate to HKEY_LOCAL_MACHINE -> SOFTWARE -> Wow6432Node -> Apache Software Foundation -> Procrun 2.0 -> JIRA<time stamp>

  7. Additional JIRA Standalone setup options (optional):
    • To increase the maximum memory JIRA can use (the default will already be 256MB), run:
      Code Block
      tomcat6 //US//service_name --JvmMx 512
      where service_name is the name of your JIRA service, e.g. JIRA123487934298.
    • To add JVM parameter, for example pass a parameter to enable JIRA's Jelly support, run:
      Code Block
      tomcat6 //US//service_name ++JvmOptions="-Djira.jelly.on=true"
      where service_name is the name of your JIRA service, e.g. JIRA123487934298.
    • If you are running JIRA and Confluence in the same JVM, increase the MaxPermSize size to 128 MB:
      Code Block
      tomcat6 //US//service_name ++JvmOptions="-XX:MaxPermSize=128m"
      where service_name is the name of your JIRA service, e.g. JIRA123487934298.
    • Occasionally, it may be useful to view JIRA's Garbage Collection information. This is especially true when investigating memory issues.To turn on the Verbose GC (garbage collection) logging, execute the following command in the command prompt:
      Code Block
      tomcat6 //US//service_name ++JvmOptions="-Xloggc:path\to\logs\atlassian-gc.log"
      where service_name is the name of your JIRA service, e.g. JIRA123487934298.
      The path (denoted by \path\to) refers to the directory in which JIRA is currently installed. For example:
      Code Block
      tomcat6 //US//service_name ++JvmOptions="-Xloggc:c:\jira\logs\atlassian-gc.log"
      where service_name is the name of your JIRA service, e.g. JIRA123487934298.
Info

See the Tomcat documentation for further service options.

Removing the JIRA service

If JIRA was installed through the Windows installer, go to the 'Control Panel' in Windows, click 'Add or Remove Programs' and remove JIRA. This will remove the service too.

If you installed the service manually (see above) it can be uninstalled with:

Code Block
service.bat remove JIRA

Alternatively, if the above does not work, use tomcat6 //DS//JIRA.

Anchor
changinguser
changinguser

Changing the Windows user that the JIRA service uses

If you are using mapped network drives for JIRA's backup directory, attachments directory, index directory or the %CATALINA_HOME%\‌* directory, you need to ensure that JIRA can write to these drives. That is, these directories all need to be writeable by the user which the JIRA service is running as. This may mean that you need to change the Windows user that the JIRA server uses.

Info

Also note that you must also specify these network drives by UNC and not letter mappings, e.g. \\backupserver\jira not z:\jira

To change the Windows user that the JIRA service uses, navigate to the service in Windows, i.e. 'Control Panel' -> 'Administrative Tools' -> 'Services'. Locate the 'Atlassian JIRA' service, right-click and view the 'Preferences'.

Go to the 'Log On' tab and change the user as desired.

Specifying the startup order of multiple services

If you have services that depend on each other, it is important that they are started in the correct order. Common examples include:

  • If you are running both JIRA and Crowd, it is important to start Crowd first, so that Crowd is running before people try to login to JIRA.
  • If the database JIRA connects to is hosted on the same server as JIRA, and is started via a Windows service, the JIRA service will only start successfully if the database service has already started first.

To set up start up dependency rules, open a command prompt and enter the following command:
C:\Documents and Settings\Developer>sc config [JIRA service] depend=[database service]
Please note the space character after 'depend='.

  • [JIRA service] is the name of the JIRA service you are running, e.g. JIRA051007111904.
  • [database service] is the name of the database service you are running, e.g. MSSQLSERVER.

If you wish, you can also set up dependency rules by editing the system registry. Please see http://support.microsoft.com/kb/193888 for details on how to do this.

Locating the name of a service

If you do not know the exact name of your JIRA service or your database service, you can find out what they are by following the steps below:

  1. Navigate to 'Control Panel' -> 'Administrative Tools' -> 'Services'.
  2. The 'Services' window should appear:
  3. Right-click on the service you wish to find out the name of, and select 'Properties' from the popup menu:
  4. The 'Service name' should appear in the 'General' tab:
    Anchor

Troubleshooting

  • Problems may occur when trying to setup JIRA Standalone to run as a Windows service with JDK 1.6. The problem is due to failure to locate "MSVCR71.DLL", which can be found in %JAVA_HOME%/bin. There are two options to resolve this problem:
    • Add %JAVA_HOME/bin to PATH, then restart the JIRA server.
    • Copy MSVCR71.DLL to system path, C:\WINDOWS\SYSTEM32 or C:\WINNT\SYSTEM32
  • Take note of the username that the service is running as, and be sure to modify the /temp and /work directories in your install directory so that this user has read and write permissions.
  • You cannot run JIRA as a service on a 64-bit operating system if you require allocating more than 1.5GB of memory, due to 32-bit JDK memory limitations and 64-bit JDK/Tomcat service issues.