Take the 2-minute tour ×

I have a large task ahead of me...modifying several hudson jobs' configuration. What I would want is to do it from command line. But per my experience, hudson will not re-read the configuration unless you force it to "reload configuration from disk".

I don't want to restart hudson just for a small change...like doing a "reload" in apache. Don't know how to read a java code but I'm guessing that what I am looking for lies in the part after saving configuration changes.

Thanks in advance, Ismael

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Hudson / Jenkins holds it's runtime configuration in memory, and only reloads it at startup or when you "reload configuration from disk".

However, reload configuration from disk is not a restart, just a re-read of the configuration.

That's all your choices, reload or restart.

Hacking it to work differently would be a major task, and if you can't yet read Java code, I wouldn't advise you to write it. Effectively you'd need to fork from the main project too, so updates won't be compatible.

If you need to do all the updates via a script, and then auto-reload the config, use hudson_cli.jar to do it.

share|improve this answer
Thanks you so much for the input @Slomojo. What I'm thinking instead is create a small shell or perl script that would do the changing on several configurations for me instead of doing the boring task of clicking each and every configuration from the web interface.Then afterwards, I could just call the "Reload configuration from disk" via the command curl http://my_hudson_address_here/hudson/reload...I know there's a hudson-cli.jar but I can't seem to make it run on my end so this little "safe hack" of mine would do it. –  icasimpan Mar 8 '11 at 0:32
Oh, I would really be asking why isn't hudson_cli working... this is a perfect use case for it. - Modifying the code base because you can't figure out how to configure a tool like hudson_cli should be setting off alarm bells for you. Post another question if you can't get hudson_cli running, and post a link here, I'm sure SO can collectively get it running for you. –  EmacsFodder Mar 8 '11 at 0:46
add comment

Here is how to reload a job in Jenkins without restarting or reloading the complete configuration with the use of groovy. You can also easily modify the script and reload some specific or all Jenkins jobs without restarting.

Jenkins allows to run the script over the UI or CLI.

UI: Copy the following script in your Jenkins Script page, for instance http://www.mydomain.com/jenkins/script

import java.io.InputStream;
import java.io.FileInputStream
import java.io.File;
import javax.xml.transform.stream.StreamSource

def hudson = hudson.model.Hudson.instance;

//to get a single job

for(job in hudson.model.Hudson.instance.items) {   

    if (job.name == "my-job") {

        def configXMLFile = job.getConfigFile();
        def file = configXMLFile.getFile();

        InputStream is = new FileInputStream(file);

        job.updateByXml(new StreamSource(is));

CLI: You can save the above script in a file and execute it remotely over CLI as a groovy script:

 java -jar jenkins-cli.jar -s http://www.mydomain.com/jenkins groovy reload-job.groovy

https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI (CLI) http://javadoc.jenkins-ci.org/hudson (API)

share|improve this answer
While at the CLI, you could just use the 'update-job' command with the xml? (which you could get using get-job or just the xml api? –  inger Jan 26 at 1:12
add comment

Your Answer


