I have the working /.jenkins folder under a specific user in home on Linux. I want to start Jenkins with another user, but re-use the .jenkins folder of the other user. How
In Tomcat 5 you can modify tomcat.conf and add the path:
export JAVA_OPTS="-DJENKINS_HOME=/home/jenkins"
Restart Jenkins.
Jenkins was not taking JENKINS_HOME env variable i set for some weird reason.
The i added this line in tomcat start up script(/etc/init.d/tomcat).
$export JENKINS_HOME=/path/to/jenkins_home/
Now jenkins points to the new jenkins home :) This will be useful especially when you install jenkins on cloud. (on an Ec2 or eucalyptus intance)
Reference: https://wiki.jenkins-ci.org/display/JENKINS/Tomcat
I think this can help you out.
Set an Environment Variable JENKINS_HOME
pointing to the .jenkins
folder and run the Jenkins command.
export JENKINS_HOME=/usr/jhon/.jenkins
java -jar jenkins.war
SET JENKINS_HOME=C:\users\jhon\.jenkins
java -jar jenkins.war
Powershell
should be like
[Environment]::SetEnvironmentVariable("JENKINS_HOME", "${PWD}\.jenkins")
java -jar jenkins.war
This will set your home directory to the current-working-directory + './jenkins'
Usually, you need to set the permissions for those files to be accessed by the new user.
See here: How to run jenkins as a different user -
especially the answers of Sagar and Peter Tran .
Cheers
I am using jenkins 1.639 as a war deployed on tomcat 7.0.67 . My JENKINS_HOME is set to /home/hims/jenkins
This is the entry of my setenv.sh file under /tomcat/bin directory
export CATALINA_OPTS="-DJENKINS_HOME=/home/hims/jenkins"
I hope this helps.
Here are the options you have:
a) Assuming you're deploying Jenkins into Tomcat,you can do the following:
In your catalina.home/conf/localhost/jenkins.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="/home/enomad/projects/jenkins/jenkins-master/war/target/jenkins" path="" reloadable="true">
<Environment name="JENKINS_HOME" value="/home/enomad/projects/jenkins-home"
type="java.lang.String" override="false"/>
</Context>
b) You can export the JENKINS_HOME=toWhateveryouwant as mentioned by Harsha in the previous post
c) You can extend your JAVA_OPTS params and add -DJENKINS_HOME=/path/to/jenkins_home/ as described here: Jenkins Mailing list
Good luck!