initialization script allows Hudson to run a post-boot processing.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@16054 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-03-06 17:19:06 +00:00
1 parent 9f4382cc44
commit 95533ee718
1 file changed
+14
@@ -183,6 +183,8 @@ import java.util.regex.Pattern;
import java.nio.charset.Charset;
import javax.servlet.RequestDispatcher;
import groovy.lang.GroovyShell;
/**
* Root object of the system.
*
@@ -543,6 +545,18 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
LoadStatistics.register();
NodeProvisioner.launch();
// run the initialization script, if it exists.
File initScript = new File(getRootDir(),"init.groovy");
if(initScript.exists()) {
LOGGER.info("Executing "+initScript);
GroovyShell shell = new GroovyShell();
try {
shell.evaluate(initScript);
} catch (Throwable t) {
t.printStackTrace();
}
}
}
public TcpSlaveAgentListener getTcpSlaveAgentListener() {