You are on page 1of 2

1/31/2014

Administering Jenkins - Jenkins - Jenkins Wiki

Administering Jenkins
Added by Kohsuke Kawaguchi, last edited by Kevin Cross on Apr 25, 2013

JENKINS_HOME directory
Jenkins needs some disk space to perform builds and keep archives. You can check this location from the configuration screen of Jenkins. By default, this is set to ~ / . j e n k i n s , but you can change this in one of the following ways: Set "JENKINS_HOME" environment variable to the new home directory before launching the servlet container. Set "JENKINS_HOME" system property to the servlet container. Set JNDI environment entry "JENKINS_HOME" to the new directory. See the container specific documentation collection for more about how to do this for your container. You can change this location after you've used Jenkins for a while, too. To do this, stop Jenkins completely, move the contents from old JENKINS_HOME to the new home, set the new JENKINS_HOME, and restart Jenkins. J E N K I N S _ H O M Ehas a fairly obvious directory structure that looks like the following: J E N K I N S _ H O M E + -c o n f i g . x m l ( j e n k i n sr o o tc o n f i g u r a t i o n ) + -* . x m l ( o t h e rs i t e w i d ec o n f i g u r a t i o nf i l e s ) + -u s e r C o n t e n t ( f i l e si nt h i sd i r e c t o r yw i l lb es e r v e du n d e ry o u rh t t p : / / s e r v e r / u s e r C o n t e n t / ) + -f i n g e r p r i n t s ( s t o r e sf i n g e r p r i n tr e c o r d s ) + -p l u g i n s ( s t o r e sp l u g i n s ) + -j o b s + -[ J O B N A M E ] ( s u bd i r e c t o r yf o re a c hj o b ) + -c o n f i g . x m l ( j o bc o n f i g u r a t i o nf i l e ) + -w o r k s p a c e ( w o r k i n gd i r e c t o r yf o rt h ev e r s i o nc o n t r o ls y s t e m ) + -l a t e s t ( s y m b o l i cl i n kt ot h el a s ts u c c e s s f u lb u i l d ) + -b u i l d s + -[ B U I L D _ I D ] ( f o re a c hb u i l d ) + -b u i l d . x m l ( b u i l dr e s u l ts u m m a r y ) + -l o g ( l o gf i l e ) + -c h a n g e l o g . x m l ( c h a n g el o g )

Back up and restore


All the settings, build logs, artifact archives are stored under the JENKINS_HOME directory. Simply archive this directory to make a back up. Similarly, restoring the data is just replacing the contents of the JENKINS_HOME directory from a back up. Back ups can be taken without stopping the server, but when you restore, please do stop the server.

Moving/copying/renaming jobs
You can: 1. Move a job from one installation of Jenkins to another by simply copying the corresponding job directory. 2. Make a copy of an existing job by making a clone of a job directory by a different name. 3. Rename an existing job by renaming a directory. Note that the if you change a job name you will need to change any other job that tries to call the renamed job. Those operations can be done even when Jenkins is running. For changes like these to take effect, you have to click "reload config" to force Jenkins to reload configuration from the disk.

Batch renaming jobs


Replacing spaces in job names with underscores https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins
1/2

1/31/2014

Administering Jenkins - Jenkins - Jenkins Wiki

Replacing spaces in job names with underscores $r e n a m e' s / \ s / _ / g '*

Archive unused jobs


Sometimes you want to remove a job from Jenkins but do so in such a way that you can resurrect it later, if the need arises. You can do this by going to $JENKINS_HOME and create an archive of the job directory. The following command illustrates how to archive a job 'xyz' and remove it. $c d$ J E N K I N S _ H O M E / j o b s $t a rc z fx y z . t g zx y z / /g ot oJ e n k i n sG U I" M a n a g eJ e n k i n s "p a g ea n d" R e l o a dC o n f i g u r a t i o nf r o mD i s k " As long as you are not building the xyz project while you create an archive, you can do this operation without taking Jenkins offline. See also the "Shelve Project" plugin.

Script Console
Useful for trouble-shooting, diagnostics or batch updates of jobs Jenkins provides a script console which gives you access to all Jenkins internals. These scripts are written in Groovy and you'll find some samples of them in this page.

URL Options
h t t p : / / [ j e n k i n s s e r v e r ] / [ c o m m a n d ] where [command] can be e x i tshutdown jenkins r e s t a r trestart jenkins r e l o a dto reload the configuration

Labels
daemon

Comments (10) Show Comments Add Comment


Powered by a free Atlassian Confluence Open Source Project License granted to Jenkins. Evaluate Confluence today.
Printed by Atlassian Confluence 3.4.7, the Enterprise Wiki.

https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins

2/2

You might also like