The Joy of Hex

Drunken Monkey Coding Style with a hint of Carlin humor

Changing the Jenkins home directory on Ubuntu - take 2

Sep 20, 2011 - 1 minute read - Comments JenkinsLinuxUbuntu

A month ago, Robert blogged about changing the Jenkins CI home directory on Ubuntu. Only thing I did not like was setting the path directly in the DAEMON_ARGS and excluding the $JENKINS_HOME variable.

It may not be a problem, but just in case, wouldn’t it be better if we just defined the $JENKINS_HOME to point to the new home directory? That way, any part of the Jenkins that relies on the $JENKINS_HOME will know where to look.

Instead of editing /etc/init.d/jenkins, and modifying it like Robert suggests to

1
DAEMON_ARGS="--name=$NAME --inherit --env=JENKINS_HOME=/home/jenkins --output=$JENKINS_LOG --pidfile=$PIDFILE"

I would suggest editing the /etc/default/jenkins

1
vi /etc/default/jenkins

And changing the $JENKINS_HOME variable (around line 23) to

1
2
# jenkins home location
JENKINS_HOME=/home/jenkins

Then restart the Jenkins with usual

1
/etc/init.d/jenkins start