提交 7aad07c3 编写于 作者: K Kohsuke Kawaguchi

[FIXED JENKINS-6594] added shutdown and safe-shutdown command

上级 a77c21dd
...@@ -92,6 +92,9 @@ Upcoming changes</a> ...@@ -92,6 +92,9 @@ Upcoming changes</a>
<li class=rfe> <li class=rfe>
Added two CLI commands to manipulate job by its XML definition. Added two CLI commands to manipulate job by its XML definition.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-8797">issue 8797</a>) (<a href="https://issues.jenkins-ci.org/browse/JENKINS-8797">issue 8797</a>)
<li class=rfe>
Added two CLI commands to shutdown Jenkins
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-6594">issue 6594</a>)
<li class=rfe> <li class=rfe>
Fixed unclear text for Tabs with no jobs Fixed unclear text for Tabs with no jobs
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-9330">issue 9330</a>) (<a href="https://issues.jenkins-ci.org/browse/JENKINS-9330">issue 9330</a>)
......
...@@ -3038,15 +3038,18 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup<TopLe ...@@ -3038,15 +3038,18 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup<TopLe
* Shutdown the system. * Shutdown the system.
* @since 1.161 * @since 1.161
*/ */
@CLIMethod(name="shutdown")
public void doExit( StaplerRequest req, StaplerResponse rsp ) throws IOException { public void doExit( StaplerRequest req, StaplerResponse rsp ) throws IOException {
checkPermission(ADMINISTER); checkPermission(ADMINISTER);
LOGGER.severe(String.format("Shutting down VM as requested by %s from %s", LOGGER.severe(String.format("Shutting down VM as requested by %s from %s",
getAuthentication().getName(), req.getRemoteAddr())); getAuthentication().getName(), req!=null?req.getRemoteAddr():"???"));
if (rsp!=null) {
rsp.setStatus(HttpServletResponse.SC_OK); rsp.setStatus(HttpServletResponse.SC_OK);
rsp.setContentType("text/plain"); rsp.setContentType("text/plain");
PrintWriter w = rsp.getWriter(); PrintWriter w = rsp.getWriter();
w.println("Shutting down"); w.println("Shutting down");
w.close(); w.close();
}
System.exit(0); System.exit(0);
} }
...@@ -3056,6 +3059,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup<TopLe ...@@ -3056,6 +3059,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup<TopLe
* Shutdown the system safely. * Shutdown the system safely.
* @since 1.332 * @since 1.332
*/ */
@CLIMethod(name="safe-shutdown")
public HttpResponse doSafeExit(StaplerRequest req) throws IOException { public HttpResponse doSafeExit(StaplerRequest req) throws IOException {
checkPermission(ADMINISTER); checkPermission(ADMINISTER);
isQuietingDown = true; isQuietingDown = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册