Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

jenkins

How can I change the location where jenkins store temp data in its slaves. Currently, it shuts down the connection to my slaves because it complains about the following

Disk space is too low. Only 0.119GB left on /tmp. 

I want to move the tmpdir location to something like /var/tmp/ instead of /tmp. How can I do that?

like image 368
cfpete Avatar asked Mar 28 '13 06:03

cfpete


People also ask

How to change tmp directory for Jenkins?

To change the temporary directory that Jenkins uses, you need to: append -Djava. io. tmpdir=$JENKINS_HOME/tmp into JENKINS_JAVA_OPTIONS variable in either /etc/sysconfig/jenkins or /etc/default/jenkins file depending on your OS.

What is @TMP folder in Jenkins?

It [@tmp folder] contains the content of any library that was loaded at run time.


2 Answers

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" 
like image 163
zzzeek Avatar answered Sep 21 '22 20:09

zzzeek


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/" 
like image 38
Daniel Alder Avatar answered Sep 25 '22 20:09

Daniel Alder