How to Change the Temporary Directory
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
JIRA uses value of java.io.tmpdir for temporary directory. Also by default Tomcat same variable and initialises this value equal to <JIRA_INSTALLATION_DIR>/temp. In some case that might lead to problem with permission or space.
Code from <JIRA_INSTALLATION_DIR>/bin/catalina.sh
:
if [ -z "$CATALINA_TMPDIR" ] ; then
# Define the java.io.tmpdir to use for Catalina
CATALINA_TMPDIR="$CATALINA_BASE"/temp
fi
...
-Djava.io.tmpdir="$CATALINA_TMPDIR"
Environment
Any version of Jira Software Data Center (or Server)
Any version Jira Service Management Data Center (or Server)
Solution
Example solution for Linux
1. Create the temp dir
Create the directory you want to move the tmpdir
to and make sure the user running the Jira process has full access to it.
Our guide on Installing Jira applications advise on giving ownership and permissions:
$ chown -R jira <new-tmpdir-path>
$ chmod -R u=rwx,go-rwx <new-tmpdir-path>
It should be on the local disk (for best performance), have enough free space and allow all permissions to the user starting the Jira process. Each Jira node should have it's own tmpdir — don't map it to a shared location.
2. Customize the setenv.sh file
To customize the java.io.tmpdir
path, you should edit the <JIRA_INSTALLATION_DIR>/bin/setenv.sh
file and add this line below the JVM_SUPPORT_RECOMMENDED_ARGS
(for ease of finding — it could be anywhere in the file, technically):
CATALINA_TMPDIR='/your/custom/path/here'
If you already have a CATALINA_TMPDIR
line in that file, you should update it instead of adding a new line.
3. Restart Jira
Jira needs to be restarted to start using the new tmpdir
.
If it's a Data Center cluster, you can perform a rolling restart one node at a time.