mirror of
https://github.com/frappe/bench.git
synced 2025-01-10 09:02:10 +00:00
[fix] [test] supervisor restart
This commit is contained in:
parent
97a4a30432
commit
47a65b9411
@ -95,12 +95,36 @@ def is_running_systemd():
|
||||
return False
|
||||
|
||||
def reload_supervisor():
|
||||
try:
|
||||
exec_cmd('sudo supervisorctl reread')
|
||||
exec_cmd('sudo supervisorctl update')
|
||||
supervisorctl = find_executable('supervisorctl')
|
||||
|
||||
try:
|
||||
# first try reread/update
|
||||
exec_cmd('sudo {0} reread'.format(supervisorctl))
|
||||
exec_cmd('sudo {0} update'.format(supervisorctl))
|
||||
return
|
||||
except CommandFailedError:
|
||||
exec_cmd('sudo supervisorctl reload')
|
||||
pass
|
||||
|
||||
try:
|
||||
# something is wrong, so try reloading
|
||||
exec_cmd('sudo {0} reload'.format(supervisorctl))
|
||||
return
|
||||
except CommandFailedError:
|
||||
pass
|
||||
|
||||
try:
|
||||
# then try restart for centos
|
||||
service('supervisord', 'restart')
|
||||
return
|
||||
except CommandFailedError:
|
||||
pass
|
||||
|
||||
try:
|
||||
# else try restart for ubuntu / debian
|
||||
service('supervisor', 'restart')
|
||||
return
|
||||
except CommandFailedError:
|
||||
pass
|
||||
|
||||
def reload_nginx():
|
||||
subprocess.check_output(['sudo', find_executable('nginx'), '-t'])
|
||||
|
@ -90,11 +90,6 @@
|
||||
become_user: root
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
|
||||
- name: Stat supervisor.conf
|
||||
stat:
|
||||
path: /etc/supervisord.conf
|
||||
register: supervisor_conf
|
||||
|
||||
- name: Check whether default supervisor.conf exists
|
||||
service:
|
||||
name: supervisord
|
||||
@ -102,4 +97,13 @@
|
||||
enabled: yes
|
||||
become: yes
|
||||
become_user: root
|
||||
when: supervisor_conf.stat.exists
|
||||
when: ansible_distribution == 'CentOS'
|
||||
|
||||
- name: Check whether default supervisor.conf exists
|
||||
service:
|
||||
name: supervisor
|
||||
state: started
|
||||
enabled: yes
|
||||
become: yes
|
||||
become_user: root
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
|
Loading…
Reference in New Issue
Block a user