Skip to content

Commit 9bfd3ac

Browse files
committedJan 7, 2012
Strip out all Mysql service controls from the WRE.
1 parent 7ea6018 commit 9bfd3ac

File tree

8 files changed

+0
-177
lines changed

8 files changed

+0
-177
lines changed
 

‎wre/etc/wre.conf

-12
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,6 @@
55
"domainRoot" : "/data/domains",
66
"user" : "webgui",
77

8-
# mysql
9-
"mysql" : {
10-
"hostname" : "localhost",
11-
"adminUser" : "root",
12-
"test" : {
13-
"database" : "test",
14-
"user" : "test",
15-
"password" : "test"
16-
},
17-
"port" : 3306
18-
},
19-
208
# starman
219
"starman" : {
2210
"maxMemory" : 100000000,

‎wre/lib/WRE/Mysql.pm

-80
Original file line numberDiff line numberDiff line change
@@ -173,86 +173,6 @@ sub load {
173173
system($command);
174174
}
175175

176-
177-
#-------------------------------------------------------------------
178-
179-
=head2 ping ( )
180-
181-
Returns a 1 if MySQL is running, or a 0 if it is not.
182-
183-
=cut
184-
185-
sub ping {
186-
my $self = shift;
187-
my $config = $self->wreConfig;
188-
my $db;
189-
eval {$db = $self->getDatabaseHandle(password=>$config->get("mysql/test/password"), username=>$config->get("mysql/test/user"))};
190-
if (defined $db) {
191-
$db->disconnect;
192-
return 1;
193-
}
194-
return 0;
195-
}
196-
197-
#-------------------------------------------------------------------
198-
199-
=head2 start ( )
200-
201-
Returns a 1 if the start was successful, or a 0 if it was not.
202-
203-
Note: The process that runs this command must be either root or the user specified in the WRE config file.
204-
205-
=cut
206-
207-
sub start {
208-
my $self = shift;
209-
my $count = 0;
210-
my $success = 0;
211-
my $config = $self->wreConfig;
212-
my $cmd = "service mysql start";
213-
`$cmd`; # catch command line output
214-
while ($count < 10 && $success == 0) {
215-
sleep(1);
216-
eval {$success = $self->ping };
217-
$count++;
218-
}
219-
if ($success) {
220-
$config->set("wreMonitor/mysqlAdministrativelyDown", 0);
221-
}
222-
return $success;
223-
}
224-
225-
#-------------------------------------------------------------------
226-
227-
=head2 stop ( )
228-
229-
Returns a 1 if the stop was successful, or a 0 if it was not.
230-
231-
Note: The process that runs this command must be either root or the user specified in the WRE config file.
232-
233-
=cut
234-
235-
sub stop {
236-
my $self = shift;
237-
my $count = 0;
238-
my $success = 1;
239-
my $config = $self->wreConfig;
240-
my $cmd = "service mysql stop";
241-
`$cmd`; # catch command line output
242-
while ($count < 10 && $success == 1) {
243-
sleep(1);
244-
eval {$success = $self->ping };
245-
$count++;
246-
}
247-
if (!$success) {
248-
$config->set("wreMonitor/mysqlAdministrativelyDown", 1);
249-
}
250-
return !$success;
251-
}
252-
253-
254-
255-
256176
} # end inside out object
257177

258178
1;

‎wre/lib/WRE/Site.pm

-14
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,9 @@ displayed to a user.
145145
sub checkCreationSanity {
146146
my $self = shift;
147147
my $wreConfig = $self->wreConfig;
148-
my $mysql = WRE::Mysql->new(wreConfig=>$wreConfig);
149148
my $sitename = $self->sitename;
150149
my $password = $adminPassword{id $self};
151150

152-
# check that mysql is alive
153-
unless (eval {$mysql->ping}) {
154-
croak "MySQL appears to be down. ".$@;
155-
return 0;
156-
}
157-
158151
# check that this user has admin rights
159152
unless (eval {$mysql->isAdmin(password=>$password)}) {
160153
croak "Invalid admin password. ". $@;
@@ -200,16 +193,9 @@ displayed to a user.
200193
sub checkDeletionSanity {
201194
my $self = shift;
202195
my $wreConfig = $self->wreConfig;
203-
my $mysql = WRE::Mysql->new(wreConfig=>$wreConfig);
204196
my $sitename = $self->sitename;
205197
my $filename = $sitename.".conf";
206198

207-
# check that mysql is alive
208-
unless (eval {$mysql->ping}) {
209-
croak "MySQL appears to be down. ".$@;
210-
return 0;
211-
}
212-
213199
# check that this user has admin rights
214200
unless (eval {$mysql->isAdmin(password=>$adminPassword{id $self})} ) {
215201
croak "Invalid admin password.";

‎wre/sbin/services/freebsd/webgui

-14
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ rcvar=`set_rcvar`
1010
extra_commands="help startweb stopweb restartweb\
1111
startstarman stopstarman restartstarman\
1212
startnginx stopnginx restartnginx\
13-
startmysql stopmysql restartmysql\
1413
startspectre stopspectre restartspectre\
1514
"
1615
help_cmd="${name}_help"
@@ -25,9 +24,6 @@ restartnginx_cmd="${stopnginx_cmd}; ${startnginx_cmd}"
2524
startstarman_cmd="${name}_startstarman"
2625
stopstarman_cmd="${name}_stopstarman"
2726
restartstarman_cmd="${stopstarman_cmd}; ${startstarman_cmd}"
28-
startmysql_cmd="${name}_startmysql"
29-
stopmysql_cmd="${name}_stopmysql"
30-
restartmysql_cmd="${stopmysql_cmd}; ${startmysql_cmd}"
3127
startspectre_cmd="${name}_startspectre"
3228
stopspectre_cmd="${name}_stopspectre"
3329
restartspectre_cmd="${stopspectre_cmd}; ${startspectre_cmd}"
@@ -45,8 +41,6 @@ webgui_help() {
4541
echo " -- Start/stop mod_perl (WebGUI) Apache service"
4642
echo " $0 { startnginx | stopnginx | restartnginx }"
4743
echo " -- Start/stop mod_proxy Apache service"
48-
echo " $0 { startmysql | stopmysql | restartmysql }"
49-
echo " -- Start/stop MySQL service"
5044
echo " $0 { startspectre | stopspectre | restartspectre }"
5145
echo " -- Start/stop SPECTRE"
5246
exit 1
@@ -76,14 +70,6 @@ webgui_stopnginx() {
7670
wreservice.pl --quiet --stop nginx
7771
}
7872

79-
webgui_startmysql() {
80-
wreservice.pl --quiet --start mysql
81-
}
82-
83-
webgui_stopmysql() {
84-
wreservice.pl --quiet --stop mysql
85-
}
86-
8773
webgui_startspectre() {
8874
wreservice.pl --quiet --start spectre
8975
}

‎wre/sbin/services/redhat/webgui

-10
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ case "$1" in
1616
restart)
1717
/data/wre/sbin/wreservice.pl --quiet --restart all
1818
;;
19-
startmysql)
20-
/data/wre/sbin/wreservice.pl --quiet --start mysql
21-
;;
22-
stopmysql)
23-
/data/wre/sbin/wreservice.pl --quiet --stop mysql
24-
;;
25-
restartmysql)
26-
/data/wre/sbin/wreservice.pl --quiet --restart mysql
27-
;;
2819
startweb)
2920
/data/wre/sbin/wreservice.pl --quiet --start web
3021
;;
@@ -68,7 +59,6 @@ case "$1" in
6859
echo $" $0 { startweb | stopweb | restartweb }"
6960
echo $" $0 { startstarman | stopstarman | restartstarman }"
7061
echo $" $0 { startnginx | stopnginx | restartnginx }"
71-
echo $" $0 { startmysql | stopmysql | restartmysql }"
7262
echo $" $0 { startspectre | stopspectre | restartspectre }"
7363
exit 1
7464
esac

‎wre/sbin/services/redhat/wre-mysql

-26
This file was deleted.

‎wre/sbin/wremonitor.pl

-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use WRE::File;
2222
use WRE::Starman;
2323
use WRE::Nginx;
24-
use WRE::Mysql;
2524
use WRE::Spectre;
2625

2726
# don't want two copies of this to run simultaneously
@@ -33,11 +32,6 @@
3332

3433
my $config = WRE::Config->new;
3534

36-
if ($config->get("wreMonitor/items/mysql") && !$config->get("wreMonitor/mysqlAdministrativelyDown")) {
37-
my $mysql = WRE::Mysql->new(wreConfig=>$config);
38-
monitor($mysql);
39-
}
40-
4135
if ($config->get("wreMonitor/items/starman") && !$config->get("wreMonitor/starmanAdministrativelyDown")) {
4236
my $starman = WRE::Starman->new(wreConfig=>$config);
4337
monitor($starman);

‎wre/sbin/wreservice.pl

-15
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use WRE::Host;
1818
use WRE::Starman;
1919
use WRE::Nginx;
20-
use WRE::Mysql;
2120
use WRE::Spectre;
2221

2322
$|=1; # turn off buffering
@@ -48,8 +47,6 @@
4847
nginx The nginx service which provides performance and security
4948
services for WebGUI.
5049
51-
mysql WebGUI's database engine.
52-
5350
spectre WebGUI's workflow governor.
5451
5552
web A shortcut that represents both starman and nginx.
@@ -101,15 +98,9 @@
10198
if (grep /^starman|modperl|all|web$/, @stop) {
10299
printSuccess(sub{WRE::Starman->new(wreConfig=>$config)->stop}, "Stop starman");
103100
}
104-
if (grep /^mysql|all$/, @stop) {
105-
printSuccess(sub{WRE::Mysql->new(wreConfig=>$config)->stop}, "Stop MySQL");
106-
}
107101
}
108102

109103
if (scalar(@start)) {
110-
if (grep /^mysql|all$/, @start) {
111-
printSuccess(sub{WRE::Mysql->new(wreConfig=>$config)->start}, "Start MySQL");
112-
}
113104
if (grep /^starman|modperl|all|web$/, @start) {
114105
printSuccess(sub{WRE::Starman->new(wreConfig=>$config)->start}, "Start starman");
115106
}
@@ -122,9 +113,6 @@
122113
}
123114

124115
if (scalar(@restart)) {
125-
if (grep /^mysql|all$/, @restart) {
126-
printSuccess(sub{WRE::Mysql->new(wreConfig=>$config)->restart}, "Restart MySQL");
127-
}
128116
if (grep /^starman|modperl|all|web$/, @restart) {
129117
printSuccess(sub{WRE::Starman->new(wreConfig=>$config)->restart}, "Restart starman");
130118
}
@@ -137,9 +125,6 @@
137125
}
138126

139127
if (scalar(@status)) {
140-
if (grep /^mysql|all$/, @status) {
141-
printSuccess(sub{WRE::Mysql->new(wreConfig=>$config)->ping}, "Ping MySQL");
142-
}
143128
if (grep /^starman|modperl|all|web$/, @status) {
144129
printSuccess(sub{WRE::Starman->new(wreConfig=>$config)->ping}, "Ping starman");
145130
}

0 commit comments

Comments
 (0)
Please sign in to comment.