-
Notifications
You must be signed in to change notification settings - Fork 0
/
ServerStartAdding.jsp
121 lines (85 loc) · 2.36 KB
/
ServerStartAdding.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<%@page import="java.io.*, java.util.StringTokenizer"%>
<html>
<head>
<title> .: LDAP GUI for Academic Institutes :. Start LDAP Server and add ldif files to it </title>
</head>
<body>
<%!
String CollegeName;
String Domain;
int deptno;
String dn;
String dept="";
String deptname[]=new String[20];
String file[]=new String[20];
%>
<%
dept="";
// Get Values from the previous form
CollegeName=request.getParameter("Clgname");
Domain=request.getParameter("domain");
deptno=Integer.parseInt(request.getParameter("DeptNo"));
dn=request.getParameter("dn");
for(int k=1;k<=deptno+4;k++)
{
file[k]=request.getParameter(Integer.toString(k));
if(k>4)
{
dept+="/usr/local/apache-tomcat-6.0.29/webapps/ROOT/LDAP/Scripts/"+file[k]+" ";
}
}
%>
<font color="darkblue">
<h1 align=center>LDAP GUI for Academic Institutes</h1>
</font>
<center>
<!--
Run the Make_slapd_conf.sh file here
-->
<h4 align="center">
.: Server Running Status:.
</h4>
<%
Runtime r=Runtime.getRuntime();
Process p=null;
String path="/usr/local/apache-tomcat-6.0.29/webapps/ROOT/LDAP/Scripts/";
String hierarchy=path+"hierarchy.ldif ";
String stud=path+"students.ldif ";
String staff=path+"staff.ldif ";
String ntstaff=path+"ntstaff.ldif ";
String param="\"cn=Manager,"+Domain+"\" ";
//out.println("PAARMA IS : "+param);
String cmd="sudo /usr/local/apache-tomcat-6.0.29/webapps/ROOT/LDAP/Scripts/ServerStart.sh "+deptno+" "+param+hierarchy+stud+staff+ntstaff+dept;
//out.println("THE COOMMOND EXECUTED IS : "+cmd);
try{
p=r.exec(cmd);
InputStreamReader isr=new InputStreamReader(p.getInputStream());
BufferedReader br=new BufferedReader(isr);
String line=null;
while((line = br.readLine()) != null){
out.write(line);
}
p.waitFor();
out.println("<font color=green>");
out.println("Server started successfully </font>");
out.println("<br><br>Following files added to the server <br>");
out.println("<font color=darkblue>");
for(int k=1;k<=deptno+4;k++)
{
out.println(file[k]+"<br>");
}
out.println("</font>");
}
catch(Exception e){
out.println("<font color=red>");
out.println("Error in Starting Server=darkblue>"+Domain+"</font>");
}
%>
<br>
<br>
<form action="CreateUsers.html">
<input type="Submit" value="Create Users">
</form>
</center>
</body>
</html>