@ CLIMethod ( name = "safe-restart" ) public HttpResponse doSafeRestart ( StaplerRequest req ) throws IOException , ServletException , RestartNotSupportedException { checkPermission ( ADMINISTER ) ; if ( req != null && req . getMethod ( ) . equals ( "GET" ) ) return HttpResponses . forwardToView ( this , "_safeRestart.jelly" ) ; if ( req == null || req . getMethod ( ) . equals ( "POST" ) ) { safeRestart ( ) ; } return HttpResponses . redirectToDot ( ) ; }
Queues up a restart of Jenkins for when there are no builds running if we can .