# To set up Jira to run as a service

To set up Jira to run as a service:

1. Open a Command Prompt.
2. Change directory (‘cd’) to the Jira application installation directory and then into this directory’s ‘bin‘ subdirectory.
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\..‘).
3. Ensure the JAVA_HOME variable is set to the root of your Java platform’s installation directory.
To find out the current value of the JAVA_HOME variable, enter echo %JAVA_HOME% at the command prompt.
4. Run the following command:
service.bat install Jira

Here is a screenshot of the process:

Jira should now be set up to run as a service.

5. In addition, to have the Jira service start automatically when the operating system starts, run:
tomcat8 //US//JIRA --Startup auto

The Jira service will automatically start up the next time the operating system reboots. The Jira service can be manually started with the command ‘net start JIRA’ and stopped with ‘net stop JIRA’.

To see what parameters the JIRA Core service is starting with, go to Start -> Run and run ‘regedt32.exe‘ and then:
* 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>

6. Additional Jira setup options (optional):
• To increase the maximum memory Jira can use (the default will already be 256MB), run:
tomcat8 //US//service_name --JvmMx 512

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:
tomcat8 //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:
tomcat8 //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:

tomcat8 //US//service_name ++JvmOptions="-Xloggc:c:\jira\logs\atlassian-gc.log"

where service_name is the name of your Jira service, e.g. JIRA123487934298.