[Slim-Checkins] r11789 - in /branches/6.5: platforms/win32/SlimTray.pl server/Slim/Utils/MySQLHelper.pm

adrian at svn.slimdevices.com adrian at svn.slimdevices.com
Sun Apr 22 08:21:01 PDT 2007


Author: adrian
Date: Sun Apr 22 08:21:00 2007
New Revision: 11789

URL: http://svn.slimdevices.com?rev=11789&view=rev
Log:
Bug: N/A
Description: attempt to start server and mysqld as processes if
starting as services fails

Modified:
    branches/6.5/platforms/win32/SlimTray.pl
    branches/6.5/server/Slim/Utils/MySQLHelper.pm

Modified: branches/6.5/platforms/win32/SlimTray.pl
URL: http://svn.slimdevices.com/branches/6.5/platforms/win32/SlimTray.pl?rev=11789&r1=11788&r2=11789&view=diff
==============================================================================
--- branches/6.5/platforms/win32/SlimTray.pl (original)
+++ branches/6.5/platforms/win32/SlimTray.pl Sun Apr 22 08:21:00 2007
@@ -329,12 +329,8 @@
 
 		if (!Win32::Service::StartService('', $serviceName)) {
 
-			showErrorMessage("Starting $errString");
-
-			$starting = 0;
-			$ssActive = 0;
-
-			return;
+			# can't start as a service - try starting as a process
+			runBackground($appExe);
 		}
 
 	} else {

Modified: branches/6.5/server/Slim/Utils/MySQLHelper.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Utils/MySQLHelper.pm?rev=11789&r1=11788&r2=11789&view=diff
==============================================================================
--- branches/6.5/server/Slim/Utils/MySQLHelper.pm (original)
+++ branches/6.5/server/Slim/Utils/MySQLHelper.pm Sun Apr 22 08:21:00 2007
@@ -202,7 +202,7 @@
 
 		my %status = ();
 
-        	Win32::Service::GetStatus('', $serviceName, \%status);
+		Win32::Service::GetStatus('', $serviceName, \%status);
 
 		if ($status{'CurrentState'} == 0x04) {
 
@@ -243,27 +243,24 @@
 
 		my %status = ();
 
-        	Win32::Service::GetStatus('', $serviceName, \%status);
-
-		# Install the service, if it isn't.
-       		if (scalar keys %status == 0) {
-
-			push @commands, ("--install $serviceName", pop @commands);
-
-			system(join(' ', @commands));
-
-        		Win32::Service::GetStatus('', $serviceName, \%status);
-
-       			if (scalar keys %status == 0) {
-
-				errorMsg("MySQLHelper: startServer() Couldn't install MySQL as a service! Will run as a process!\n");
-				$service = 0;
-			}
-		}
-
-		if ($service) {
-
-			Win32::Service::StartService('', $serviceName);
+		Win32::Service::GetStatus('', $serviceName, \%status);
+
+		# Attempt to install the service, if it isn't.
+		# NB mysqld fails immediately if install is not allowed by user account so don't add this to @commands
+		if (scalar keys %status == 0) {
+
+			system( sprintf "%s --install %s %s", $commands[0], $serviceName, $commands[1] );
+		}
+
+		Win32::Service::StartService('', $serviceName);
+
+		Win32::Service::GetStatus('', $serviceName, \%status);
+
+		if (scalar keys %status == 0 || ($status{'CurrentState'} != 0x02 && $status{'CurrentState'} != 0x04)) {
+
+			$::d_mysql && msgf("Couldn't run MySQL as a service, will run as a process\n");
+
+			$service = 0;
 		}
 	}
 



More information about the checkins mailing list