exposed /exit for admins to shutdown VM.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6294 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2007-12-16 01:50:28 +00:00
1 parent 512b787d07
commit f346fdf378
1 file changed
+19
@@ -1779,6 +1779,25 @@ public final class Hudson extends View implements ItemGroup<TopLevelItem>, Node
rsp.getWriter().println("GCed");
}
/**
* Shutdown the system.
* @since 1.161
*/
public void doExit( StaplerRequest req, StaplerResponse rsp ) throws IOException {
if(!Hudson.adminCheck(req,rsp))
return;
LOGGER.severe(String.format("Shutting down VM as requested by {0} from {1}",
SecurityContextHolder.getContext().getAuthentication(),
req.getRemoteAddr()));
rsp.setStatus(HttpServletResponse.SC_OK);
rsp.setContentType("text/plain");
PrintWriter w = rsp.getWriter();
w.println("Shutting down");
w.close();
System.exit(0);
}
/**
* Configure the logging level.
*/