Administering Jenkins

Skip to end of metadata
Go to start of metadata

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 ~/.jenkins, 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.

JENKINS_HOME has a fairly obvious directory structure that looks like the following:

JENKINS_HOME
 +- config.xml     (jenkins root configuration)
 +- *.xml          (other site-wide configuration files)
 +- userContent    (files in this directory will be served under your http://server/userContent/)
 +- fingerprints   (stores fingerprint records)
 +- plugins        (stores plugins)
 +- jobs
     +- [JOBNAME]      (sub directory for each job)
         +- config.xml     (job configuration file)
         +- workspace      (working directory for the version control system)
         +- latest         (symbolic link to the last successful build)
         +- builds
             +- [BUILD_ID]     (for each build)
                 +- build.xml      (build result summary)
                 +- log            (log file)
                 +- changelog.xml  (change log)

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

$ rename '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.

$ cd $JENKINS_HOME/jobs
$ tar czf xyz.tgz xyz
// go to Jenkins GUI "Manage Jenkins" page and "Reload Configuration from Disk"

As long as you are not building the xyz project while you create an archive, you can do this operation without taking Jenkins offline.

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

http://[jenkins-server]/[command]

where [command] can be

  • exit shutdown jenkins
  • restart restart jenkins
  • reload to reload the configuration

Labels

daemon daemon Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Feb 15, 2008

    Anonymous says:

    I am getting "Hudson detected that you appear to be running more tha...

    I am getting "Hudson detected that you appear to be running more than one
    instance of Hudson that share the same home directory '/home/java/.hudson'. This
    greatly confuses Hudson and you will likely experience strange behaviors, so
    please correct the situation." error occasionally.  I am using version 1.180.
    Is this an issue?  What am I doing wrong?

  2. May 20, 2008

    Li Yun says:

    How to hide the WorkSpace Link and picture link on the Web GUI, I don't want the...

    How to hide the WorkSpace Link and picture link on the Web GUI, I don't want the source code can be download by anyone. Is there anyone know how to do that?

     liyun935cn@yahoo.com.cn

  3. May 20, 2008

    Li Yun says:

    How to hide the WorkSpace Link and picture link on the Web GUI, I don't want the...

    How to hide the WorkSpace Link and picture link on the Web GUI, I don't want the source code can be download by anyone. Is there anyone know how to do that?

     liyun935cn@yahoo.com.cn

  4. May 20, 2008

    Li Yun says:

    How to hide the WorkSpace Link and picture link on the Web GUI, I don't want the...

    How to hide the WorkSpace Link and picture link on the Web GUI, I don't want the source code can be download by anyone. Is there anyone know how to do that?

     liyun935cn@yahoo.com.cn

  5. Oct 08, 2008

    Lionel says:

    What path/partition is used to determine "free disk space" in Linux?  I'm c...

    What path/partition is used to determine "free disk space" in Linux?  I'm constantly getting:

    WARNING: Making  offline temporarily due to the lack of disk space

    When I look at /computer, it shows "Free Disk Space" to be 0.680 GB for master, but I have at least 30GB free in the user.dir and user.home directories (viewing with df). Free swap space looks fine.

  6. Dec 16, 2008

    elser - says:

    I have a backup-ing job that runs every hour and gathers only configuration xmls...

    I have a backup-ing job that runs every hour and gathers only configuration xmls that are needed to restore jobs.
    It is built periodically (every hour from 8:00AM till 6:00PM, Monday-Friday):
    0 8-18 * * 1-5

    It contains single "Execute shell" build step:

    export CUR_PATH=`pwd`
    cd $HUDSON_HOME
    find -maxdepth 3 -name config.xml|xargs tar cvf configs.tar
    mv configs.tar $CUR_PATH/configs.tar

    And  "Archive the artifacts" contains only "configs.tar", so we keep the history of jobs.
    You can even add some scp to push the tar forward to another server.

  7. Sep 19, 2009

    sheck - says:

    Hi all, Does anyone know if it is possible to share the same build number betwe...

    Hi all,

    Does anyone know if it is possible to share the same build number between several jobs?

    I already tried a little hack but it did not work:

    I used symlinks so that job A and job B  points to the same nextBuildNumber file. But the hudson job process seems to delete the nextBuildNumber file and then create a new nextBuildNumber (so the symlinks were destroyed).

    Thanks, Stephane



  8. Sep 26, 2010

    Tomáš Homola says:

    a
  9. Mar 02, 2012

    naga raju says:

    Hi All, i am new to the jenkins ci tool.creating and configuring jobns every th...

    Hi All,

    i am new to the jenkins ci tool.creating and configuring jobns every thng working fine.

    But sometimes jenkins is shutting down automatically.

    i dont the reason why it is behaving like that.

    So please can anyone help me how to fix this issue.

    Thanks,

    Raj

  10. Aug 07, 2013

    Victor Silva says:

    The backup suggestions did not works for me: Windows can't copy directories whic...

    The backup suggestions did not works for me: Windows can't copy directories which contains symbolic links. I tried to do it some other ways, but few Windows tools recognize symbolic links, and the ones that does tends to replace them with copies of the linked data.