mirror of
https://github.com/frappe/bench.git
synced 2025-01-25 07:58:24 +00:00
[Fix] Command needs superuser previlege to run
This commit is contained in:
parent
41f3f7e639
commit
85f8d1be30
@ -50,7 +50,7 @@ def cmd_requires_root():
|
|||||||
if len(sys.argv) > 2 and sys.argv[2] in ('production', 'sudoers', 'lets-encrypt'):
|
if len(sys.argv) > 2 and sys.argv[2] in ('production', 'sudoers', 'lets-encrypt'):
|
||||||
return True
|
return True
|
||||||
#Changed > to >=, unsure if will cause the apolcaypse
|
#Changed > to >=, unsure if will cause the apolcaypse
|
||||||
if len(sys.argv) >= 2 and sys.argv[1] in ('patch', 'renew-lets-encrypt'):
|
if len(sys.argv) >= 2 and sys.argv[1] in ('patch', 'renew-lets-encrypt', 'disable-production'):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def change_dir():
|
def change_dir():
|
||||||
|
@ -23,7 +23,7 @@ def setup_production(user, bench_path='.'):
|
|||||||
if not os.path.islink(nginx_conf):
|
if not os.path.islink(nginx_conf):
|
||||||
os.symlink(os.path.abspath(os.path.join(bench_path, 'config', 'nginx.conf')), nginx_conf)
|
os.symlink(os.path.abspath(os.path.join(bench_path, 'config', 'nginx.conf')), nginx_conf)
|
||||||
|
|
||||||
exec_cmd('supervisorctl reload')
|
exec_cmd('sudo supervisorctl reload')
|
||||||
if os.environ.get('NO_SERVICE_RESTART'):
|
if os.environ.get('NO_SERVICE_RESTART'):
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -53,9 +53,9 @@ def disable_production(bench_path='.'):
|
|||||||
|
|
||||||
def service(service, option):
|
def service(service, option):
|
||||||
if os.path.basename(get_program(['systemctl']) or '') == 'systemctl' and is_running_systemd():
|
if os.path.basename(get_program(['systemctl']) or '') == 'systemctl' and is_running_systemd():
|
||||||
exec_cmd("{service_manager} {option} {service}".format(service_manager='systemctl', option=option, service=service))
|
exec_cmd("sudo {service_manager} {option} {service}".format(service_manager='systemctl', option=option, service=service))
|
||||||
elif os.path.basename(get_program(['service']) or '') == 'service':
|
elif os.path.basename(get_program(['service']) or '') == 'service':
|
||||||
exec_cmd("{service_manager} {service} {option} ".format(service_manager='service', service=service, option=option))
|
exec_cmd("sudo {service_manager} {service} {option} ".format(service_manager='service', service=service, option=option))
|
||||||
else:
|
else:
|
||||||
# look for 'service_manager' and 'service_manager_command' in environment
|
# look for 'service_manager' and 'service_manager_command' in environment
|
||||||
service_manager = os.environ.get("BENCH_SERVICE_MANAGER")
|
service_manager = os.environ.get("BENCH_SERVICE_MANAGER")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user