Changeset View
Changeset View
Standalone View
Standalone View
pykolab/setup/setup_mysql.py
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | socket_paths = [ | ||||
"/var/run/mysql/mysql.sock", | "/var/run/mysql/mysql.sock", | ||||
"/var/run/mysqld/mysqld.pid" | "/var/run/mysqld/mysqld.pid" | ||||
] | ] | ||||
# on CentOS7, there is MariaDB instead of MySQL | # on CentOS7, there is MariaDB instead of MySQL | ||||
mysqlservice = 'mysqld.service' | mysqlservice = 'mysqld.service' | ||||
if os.path.isfile('/usr/lib/systemd/system/mariadb.service'): | if os.path.isfile('/usr/lib/systemd/system/mariadb.service'): | ||||
mysqlservice = 'mariadb.service' | mysqlservice = 'mariadb.service' | ||||
if os.path.isfile('/bin/systemctl') and not os.path.isfile('/usr/lib/systemd/system/' + mysqlservice): | elif os.path.isfile('/usr/lib/systemd/system/mysql.service'): | ||||
mysqlservice = 'mysql.service' | |||||
if not os.path.isfile('/usr/lib/systemd/system/' + mysqlservice): | |||||
# on Debian Jessie, systemctl restart mysql | # on Debian Jessie, systemctl restart mysql | ||||
mysqlservice = 'mysql' | mysqlservice = 'mysql' | ||||
if os.path.isfile('/bin/systemctl'): | if os.path.isfile('/bin/systemctl'): | ||||
subprocess.call(['/bin/systemctl', 'restart', mysqlservice]) | subprocess.call(['/bin/systemctl', 'restart', mysqlservice]) | ||||
elif os.path.isfile('/sbin/service'): | elif os.path.isfile('/sbin/service'): | ||||
subprocess.call(['/sbin/service', 'mysqld', 'restart']) | subprocess.call(['/sbin/service', 'mysqld', 'restart']) | ||||
elif os.path.isfile('/usr/sbin/service'): | elif os.path.isfile('/usr/sbin/service'): | ||||
▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines |