Running JIRA Standalone as a Service
| 
PDF |
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.
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 (reliably found in logs\stdout*.log in your JIRA directory, and rotated
daily).
There are two ways to install JIRA as a service: via the installer, and manually.
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" checkbox
when running the Windows installer:
You will need Administrator rights to your PC for this to work.
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).
Note
If you are running 64-bit Windows, please note that Apache Tomcat cannot run as a Windows service if you are using a
64 bit JDK (see
JRA-12965). Please ensure that you are using
a 32 bit JDK. (If you used the Windows Installer, a 32 bit JDK has already been installed for you.)
- Open a DOS prompt,
- 'cd' to the JIRA Standalone directory, and then the bin\ subdirectory
-
If a directory in the path has spaces (eg. 'C:\Program Files\..'), please convert it to its eight-character
equivalent (eg. c:\Progra~1\..).
- Ensure the JAVA_HOME variable is set to the JDK base directory, with echo %JAVA_HOME%.
-
Run the following command:
service.bat install JIRA
Here is a screenshot of the process:
JIRA should now be installed as a service.
-
In addition, to have the JIRA service start automatically when the server starts, run:
tomcat5 //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'.
Note
To see what parameters the JIRA service is starting with, Go to Start -> Run, and run "regedt32.exe". There
should be an entry at HKEY_LOCAL_MACHINE -> SOFTWARE -> Apache Software Foundation -> Procrun 2.0 ->
JIRA.
-
Additional JIRA Standalone setup options (optional):
-
To increase the maximum memory JIRA can use (the default will already be 256MB), run:
tomcat5 //US//JIRA --JvmMx 512
-
To add JVM parameter, for example pass a parameter to enable JIRA's Jelly support, run:
tomcat5 //US//JIRA ++JvmOptions="-Djira.jelly.on=true"
-
If you are running JIRA and Confluence in the same JVM, increase the MaxPermSize size to 128 MB:
tomcat5 //US//JIRA ++JvmOptions="-XX:MaxPermSize=128m"
-
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
tomcat5 //US//JIRA ++JvmOptions="-Xloggc:path\to\logs\atlassian-gc.log"
The path (denoted by \path\to\) refers to the directory in which JIRA is currently installed. For example:
tomcat5 //US//JIRA ++JvmOptions="-Xloggc:c:\jira\logs\atlassian-gc.log"
Removing the JIRA service
If JIRA was installed through the Windows installer, go to the Control Panel, 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:
service.bat remove JIRA
Alternatively, if the above does not work, use tomcat5 //DS//JIRA.
Changing the Windows user that the JIRA service uses
If you are using mapped network drives for JIRA's backup directory, attachments directory, index directoy 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.
Note
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:
Control Panel -> Administrative Tools -> Services.
Locate the Apache Tomcat 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.
For example, 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.
For information about specifying the startup order for multiple services, please see
http://support.microsoft.com/kb/193888.
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, restart server
- Copy MSVCR71.DLL to system path, C:\WINDOWS\SYSTEM32 or C:\WINNT\SYSTEM32