[Other doc versions]
[Doc downloads (PDF, HTML, XML)]
For long-term use on a Windows server, Stash should be configured to run as a Windows service. This has the following advantages:
On this page:
Before you start
If you are using a 64-bit version of Windows, first ensure that Stash uses a 64-bit JVM (check by running java -version
in a Command Prompt, and ensure that the JAVA_HOME
system environment variable points to the 64-bit JVM), and then replace the 32-bit Tomcat binaries with their 64-bit counterparts in the <Stash installation directory>/bin
directory:
cd <STASH-INST/bin> rename tomcat7.exe tomcat7.exe.x86 rename tcnative-1.dll tcnative-1.dll.x86 rename tomcat7.exe.x64 tomcat7.exe rename tcnative-1.dll.x64 tcnative-1.dll
JAVA_HOME
variable is set to the root of your Java platform's installation directory.JAVA_HOME
cannot contain spaces, so the default Java installation directory of C:\Program Files\Java won't work.Stash installation directory
>. See Git push operations extremely slow on Windows.STASH_HOME
as a system environment variable, before running the service.bat
script.To run Stash as a Windows service:
STASH_HOME
as the Variable name and the absolute path to your Stash home directory as the Variable value. Don't use a trailing backslash. Note that the Stash home directory should not be located inside the <Stash installation directory>
. You must do this step before running the service.bat
script in Step 5 below.bin
subdirectory. If a directory in the path has spaces (e.g. C:\Program Files\..
), use its eight-character equivalent (e.g. C:\Progra~1\..
).Run the following commands:
> service.bat install > tomcat7 //US//STASH --Startup auto
This will create a service with the name "STASH" and a display name of "Atlassian Stash". If you would like to customize the name you can instead run:
> service.bat install MyName > tomcat7 //US//MyName --Startup auto
This will create the service as "MyName" with a display name of "Atlassian Stash MyName".
Run the following command to increase the amount of memory that Stash can use (the default is 768 Mb):
> tomcat7 //US//service_name --JvmMx 1024
Here is an example:
C:\Program Files (x86)\atlassian-stash-2.0.0\bin>service.bat install Installing the service 'STASH' ... Using CATALINA_HOME: "C:\Program Files (x86)\atlassian-stash-2.0.0" Using CATALINA_BASE: "C:\Program Files (x86)\atlassian-stash-2.0.0" Using JAVA_HOME: "C:\Java\jre6" Using JVM: "auto" The service 'STASH' has been installed. C:\Program Files (x86)\atlassian-stash-2.0.0\bin>tomcat7.exe //US//STASH --Startup auto C:\Program Files (x86)\atlassian-stash-2.0.0\bin>tomcat7.exe //US//STASH --JvmMx 1024 C:\Program Files (x86)\atlassian-stash-2.0.0\bin>net start STASH The Atlassian Stash service is starting. The Atlassian Stash service was started successfully.
%JAVA_HOME%/bin
. There are two options to resolve this problem:service.bat install
in a Command Prompt running as an Administrator.