Relocating JENKINS_HOME on Windows when installed as service

前端 未结 8 1213
野趣味
野趣味 2021-01-01 11:03

To free up space on C:, I would like to move my Jenkins data files (specifically the \\jobs directory) from the default installation directory

8条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-01 11:59

    Stumbled upon this question because I was short on HDD on C:/ but had plenty on D:/.

    The answer of Jeanne Boyarsky had exactly zero effect on my Jenkins. Although I changed the two variables, Jenkins still used the original workspace and jobs directories which consumed 1/3 of my C:/ drive.

    A colleague pointed me to the dead easy solution of simply using Symbolic Links for the directories.

    After shutting down Jenkins, open your CMD on the %JENKINS_HOME% directory and simply create two links for the big directories:

    pushd %JENKINS_HOME%
    :: save the old directories
    ren workspace workspace.old
    ren jobs jobs.old
    :: now create the links
    mklink /D /J workspace D:\jenkins\workspace
    mklink /D /J jobs D:\jenkins\jobs
    :: copy the original jobs to the new location
    xcopy jobs.old\* jobs\ /sy
    

    After this, restart your Jenkins. If everything works fine, you can safely delete the .old directories.

提交回复
热议问题