How to change the jenkins `/tmp` dir location?

You can use Java Service Wrapper. And config your wrapper(look example)

wrapper.java.additional.2=-Djava.io.tmpdir=../tmp

Or you can create symbolic link /var/tmp folder and put on home jenkins daemon.


On a debian/ubuntu machine, add the following to the file /etc/default/jenkins:

# use a different tmpdir for jenkins
JAVA_ARGS="$JAVA_ARGS -Djava.io.tmpdir=/var/tmp/"

If using "SSH Slaves Plugin", you can set JVM Options in "Advanced settings" and add:

-Djava.io.tmpdir=/my/temp

Just add "-Djava.io.tmpdir=/path/to/tmp" to the java command line options (you don't need any extra service wrapper).

Depending on your installation there might be an existing startup script and/or config file this can go into. On my fedora system, I can add the option to the /etc/sysconfig/jenkins file:

## Type:        string
## Default:     "-Djava.awt.headless=true"
## ServiceRestart: jenkins
#
# Options to pass to java when running Jenkins.
#
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Djava.io.tmpdir=/var/tmp"

Tags:

Jenkins