[PATCH 07/16] Debianize service maintenance script path ("/usr/sbin/service"), as well as the start sequence-integration tool ("/usr/sbin/update-rc.d");

Johannes Graumann johannes_graumann at web.de
Mon Oct 1 17:47:04 CEST 2012


---
 pykolab/setup/setup_mysql.py |   21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py
index 093d187..9a046b2 100644
--- a/pykolab/setup/setup_mysql.py
+++ b/pykolab/setup/setup_mysql.py
@@ -40,15 +40,24 @@ def description():
 
 def execute(*args, **kw):
     if os.path.isfile('/bin/systemctl'):
-        subprocess.call(['/bin/systemctl', 'start', 'mysqld.service'])
-        subprocess.call(['/bin/systemctl', 'enable', 'mysqld.service'])
+        subprocess.call(['/bin/systemctl', 'restart', 'mysqld.target'])
     elif os.path.isfile('/sbin/service'):
-        subprocess.call(['/sbin/service', 'mysqld', 'start'])
-        subprocess.call(['/sbin/chkconfig', 'mysqld', 'on'])
+        subprocess.call(['/sbin/service', 'mysqld', 'restart'])
+    elif os.path.isfile('/usr/sbin/service'):
+	subprocess.call(['/usr/sbin/service','mysqld','restart'])
     else:
-        log.error(_("Could not start and configure to start on boot, the " + \
-                "MySQL database service."))
+        log.error(_("Could not start the MySQL database service."))
 
+    if os.path.isfile('/bin/systemctl'):
+        subprocess.call(['/bin/systemctl', 'enable', 'mysqld.target'])
+    elif os.path.isfile('/sbin/chkconfig'):
+        subprocess.call(['/sbin/chkconfig', 'mysqld', 'on'])
+    elif os.path.isfile('/usr/sbin/update-rc.d'):
+        subprocess.call(['/usr/sbin/update-rc.d', 'mysqld', 'defaults'])
+    else:
+        log.error(_("Could not configure to start on boot, the " + \
+                "MySQL database service."))                
+                
     print >> sys.stderr, utils.multiline_message(
             _("""
                     Please supply a root password for MySQL. This password will
-- 
1.7.10.4




More information about the devel mailing list