mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 08:30:39 +00:00
commit
418a1b6b91
@ -5,13 +5,12 @@ import os
|
||||
import shutil
|
||||
|
||||
def restart_service(service):
|
||||
program = get_program(['systemctl', 'service'])
|
||||
if not program:
|
||||
if os.path.basename(get_program(['systemctl'])) == 'systemctl' and is_running_systemd():
|
||||
exec_cmd("{prog} restart {service}".format(prog='systemctl', service=service))
|
||||
elif os.path.basename(get_program(['service'])) == 'service':
|
||||
exec_cmd("{prog} {service} restart ".format(prog='service', service=service))
|
||||
else:
|
||||
raise Exception, 'No service manager found'
|
||||
elif os.path.basename(program) == 'systemctl':
|
||||
exec_cmd("{prog} restart {service}".format(prog=program, service=service))
|
||||
elif os.path.basename(program) == 'service':
|
||||
exec_cmd("{prog} {service} restart ".format(prog=program, service=service))
|
||||
|
||||
def get_supervisor_confdir():
|
||||
possiblities = ('/etc/supervisor/conf.d', '/etc/supervisor.d/', '/etc/supervisord/conf.d', '/etc/supervisord.d')
|
||||
@ -30,6 +29,14 @@ def remove_default_nginx_configs():
|
||||
def is_centos7():
|
||||
return os.path.exists('/etc/redhat-release') and get_cmd_output("cat /etc/redhat-release | sed 's/Linux\ //g' | cut -d' ' -f3 | cut -d. -f1").strip() == '7'
|
||||
|
||||
def is_running_systemd():
|
||||
with open('/proc/1/comm') as f:
|
||||
comm = f.read().strip()
|
||||
if comm == "init":
|
||||
return False
|
||||
elif comm == "systemd":
|
||||
return True
|
||||
return False
|
||||
|
||||
def copy_default_nginx_config():
|
||||
shutil.copy(os.path.join(os.path.dirname(__file__), 'templates', 'nginx_default.conf'), '/etc/nginx/nginx.conf')
|
||||
|
@ -139,7 +139,9 @@ add_epel_centos7() {
|
||||
}
|
||||
|
||||
add_maria_db_repo() {
|
||||
if [ "$OS" == "centos" ]; then
|
||||
if [ "$OS" == "Ubuntu" ] && [ $VER=="utopic" ]; then
|
||||
return
|
||||
elif [ "$OS" == "centos" ]; then
|
||||
echo Adding centos mariadb repo
|
||||
add_centos6_mariadb_repo
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user