mirror of https://github.com/apache/lucene.git
first working version
git-svn-id: https://svn.apache.org/repos/asf/incubator/solr/trunk@398983 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
89f1018ef7
commit
c1e12c5a89
|
@ -6,32 +6,15 @@
|
||||||
<%@ page import="java.util.Date"%>
|
<%@ page import="java.util.Date"%>
|
||||||
<%@ page import="java.util.logging.Level"%>
|
<%@ page import="java.util.logging.Level"%>
|
||||||
<%@ page import="java.util.logging.Logger"%>
|
<%@ page import="java.util.logging.Logger"%>
|
||||||
|
<%@include file="header.jsp" %>
|
||||||
<%
|
<%
|
||||||
SolrCore core = SolrCore.getSolrCore();
|
|
||||||
IndexSchema schema = core.getSchema();
|
|
||||||
String collectionName = schema!=null ? schema.getName():"unknown";
|
|
||||||
|
|
||||||
String action = request.getParameter("action");
|
String action = request.getParameter("action");
|
||||||
String logging = request.getParameter("log");
|
String logging = request.getParameter("log");
|
||||||
String enableActionStatus = "";
|
String enableActionStatus = "";
|
||||||
boolean isValid = false;
|
boolean isValid = false;
|
||||||
boolean wasOk = true;
|
|
||||||
|
|
||||||
String rootdir = "/var/opt/resin3/"+request.getServerPort();
|
File enableFile = new File(enabledFile);
|
||||||
File pidFile = new File(rootdir + "/logs/resin.pid");
|
|
||||||
String startTime = "";
|
|
||||||
|
|
||||||
try {
|
|
||||||
startTime = (pidFile.lastModified() > 0)
|
|
||||||
? new Date(pidFile.lastModified()).toString()
|
|
||||||
: "No Resin Pid found (logs/resin.pid)";
|
|
||||||
} catch (Exception e) {
|
|
||||||
out.println("<ERROR>");
|
|
||||||
out.println("Couldn't open Solr pid file:" + e.toString());
|
|
||||||
out.println("</ERROR>");
|
|
||||||
}
|
|
||||||
|
|
||||||
File enableFile = new File(rootdir + "/logs/server-enabled");
|
|
||||||
|
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
// Validate fname
|
// Validate fname
|
||||||
|
@ -46,25 +29,27 @@
|
||||||
if ("Enable".compareTo(action) == 0) {
|
if ("Enable".compareTo(action) == 0) {
|
||||||
try {
|
try {
|
||||||
if (enableFile.createNewFile()) {
|
if (enableFile.createNewFile()) {
|
||||||
enableActionStatus += "Enable Succeeded";
|
enableActionStatus += "Enable Succeeded (enable file ";
|
||||||
|
enableActionStatus += enabledFile;
|
||||||
|
enableActionStatus += " created)";
|
||||||
} else {
|
} else {
|
||||||
enableActionStatus += "Already Enabled";
|
enableActionStatus += "Already Enabled";
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
enableActionStatus += "Enable Failed: " + e.toString();
|
enableActionStatus += "Enable Failed: " + e.toString();
|
||||||
wasOk = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ("Disable".compareTo(action) == 0) {
|
if ("Disable".compareTo(action) == 0) {
|
||||||
try {
|
try {
|
||||||
if (enableFile.delete()) {
|
if (enableFile.delete()) {
|
||||||
enableActionStatus = "Disable Succeeded";
|
enableActionStatus = "Disable Succeeded (enable file ";
|
||||||
|
enableActionStatus += enabledFile;
|
||||||
|
enableActionStatus += " removed)";
|
||||||
} else {
|
} else {
|
||||||
enableActionStatus = "Already Disabled";
|
enableActionStatus = "Already Disabled";
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
enableActionStatus += "Disable Failed: " + e.toString();
|
enableActionStatus += "Disable Failed: " + e.toString();
|
||||||
wasOk = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (logging != null) {
|
if (logging != null) {
|
||||||
|
@ -80,40 +65,13 @@
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
enableActionStatus += "Set Log Level (" + logging + ") Failed: "
|
enableActionStatus += "Set Log Level (" + logging + ") Failed: "
|
||||||
+ e.toString();
|
+ e.toString();
|
||||||
wasOk = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
enableActionStatus = "Illegal Action";
|
enableActionStatus = "Illegal Action";
|
||||||
}
|
}
|
||||||
|
|
||||||
String hostname="localhost";
|
|
||||||
try {
|
|
||||||
InetAddress addr = InetAddress.getLocalHost();
|
|
||||||
// Get IP Address
|
|
||||||
byte[] ipAddr = addr.getAddress();
|
|
||||||
// Get hostname
|
|
||||||
// hostname = addr.getHostName();
|
|
||||||
hostname = addr.getCanonicalHostName();
|
|
||||||
} catch (UnknownHostException e) {}
|
|
||||||
%>
|
%>
|
||||||
<%
|
|
||||||
if (wasOk) {
|
|
||||||
%>
|
|
||||||
<meta http-equiv="refresh" content="4;url=index.jsp">
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" type="text/css" href="solr-admin.css">
|
|
||||||
<link rel="icon" href="favicon.ico" type="image/ico">
|
|
||||||
<link rel="shortcut icon" href="favicon.ico" type="image/ico">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<a href="."><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="SOLR"></a>
|
|
||||||
<h1>SOLR Action (<%= collectionName %>) - <%= action %></h1>
|
|
||||||
<%= hostname %> : <%= request.getServerPort() %>
|
|
||||||
<br clear="all">
|
<br clear="all">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -133,23 +91,6 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<br>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Current Time: <%= new Date().toString() %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Server Start At: <%= startTime %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<br><br>
|
<br><br>
|
||||||
<a href=".">Return to Admin Page</a>
|
<a href=".">Return to Admin Page</a>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue