|
Date: 3/27/2008 5:22 pm · Subject: Re: Wre Installation - Mysql process problems · Rating: -2
The wreservice.pl does this dit: if (scalar(@start)) { if (grep / printSuccess(sub{WRE::Mysql->new(wreConfig=>$config)->start}, "Start MySQL"); That subroutine ->start can be found in: /data/wre/lib/WRE/Mysql.pm #-------------------------------------------------------------------
=head2 start ( )
Returns a 1 if the start was successful, or a 0 if it was not.
Note: The process that runs this command must be either root or the user specified in the WRE config file. =cut
sub start { my $self = shift; my $count = 0; my $success = 0; my $config = $self->wreConfig; $config->set("wreMonitor/mysqlAdministrativelyDown", 0); my $host = WRE::Host->new(wreConfig => $config); my $cmd = ""; if ($host->getOsName eq "windows") { $cmd = "net start WREmysql"; } else { $cmd = $config->getRoot("/prereqs/share/mysql/mysql.server")." start --user=".$config->get("user"); } `$cmd`; # catch command line output while ($count < 10 && $success == 0) { sleep(1); eval {$success = $self->ping }; $count++; } return $success; }
#-------------------------------------------------------------------
So what it (actually) does is: create the command that is (in total) something like this: /data/wre/prereqs/share/mysql/mysql.server start --user=webgui It then runs this process. After that it tries to '$self->ping' it for 10 seconds every second. If '$self->ping' returns sucess then ->start returns success. So success is not determined by something the above command returns. Instead we have to look at the ->ping subroutine. So here is the ping subroutine: #-------------------------------------------------------------------
=head2 ping ( )
Returns a 1 if MySQL is running, or a 0 if it is not.
=cut
sub ping { my $self = shift; my $config = $self->wreConfig; my $db; eval {$db = $self->getDatabaseHandle(password=>$config->get("mysql/test/password"), username=>$config->get("mysql/test/user"))}; if (defined $db) { $db->disconnect; return 1; } return 0; }
#------------------------------------------------------------------- So this subroutine returns success if the test databaseuser can be connected with the testdatabasepassword. Configuration of the user/password combination that is used for this is found in the wre configuration, which is configurably by editting /data/wre/etc/wre.conf "mysql" : { "test" : { "database" : "test", "password" : "test", "user" : "test" }, "hostname" : "localhost", "adminUser" : "root", "port" : "3306" }, near the end of the file. Koen de Jonge - ProcoliX http://www.procolix.com Hosting - WebGUI - Virtualization
--- (Edited on 27-March-2008 23:22 [GMT+0100] by koen) ---
|