jenkins 更换主目录

步骤如下:

1,停止jinkens

1
service jenkins stop

2, 修改jenkins配置文件

vim /etc/sysconfig/jenkins,修改JENKINS_HOME

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Description: Jenkins Automation Server
## Type: string
## Default: "/var/lib/jenkins"
## ServiceRestart: jenkins
#
# Directory where Jenkins store its configuration and working
# files (checkouts, build reports, artifacts, ...).
#
#JENKINS_HOME="/var/lib/jenkins"
JENKINS_HOME="/mydata/jenkins/jenkins"

## Type: string
## Default: ""
## ServiceRestart: jenkins
#
# Java executable to run Jenkins
# When left empty, we'll try to find the suitable Java.
#
JENKINS_JAVA_CMD=""

## Type: string
## Default: "jenkins"
## ServiceRestart: jenkins
#
# Unix user account that runs the Jenkins daemon
# Be careful when you change this, as you need to update
# permissions of $JENKINS_HOME and /var/log/jenkins.
#
JENKINS_USER="jenkins"

3,拷贝/var/lib/jenkins到新目录

1
cp -af /var/lib/jenkins/* /mydata/jenkins/dataspace

保持jenkins的用户权限

4,重启jenkins

1
service jenkins start

参考

https://blog.csdn.net/u013066244/article/details/70884952

Author: Binger Chen
Link: http://www.kekefund.com/2019/09/01/jenkins-change-pwd/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.