mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 14:32:22 +00:00
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:
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.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user