2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 00:37:51 +00:00

[fix] use environment variable to use custom service manager

This commit is contained in:
Anand Doshi 2015-08-25 15:24:23 +05:30
parent 69ceb7e9b1
commit fcea709bbc

View File

@ -10,11 +10,10 @@ def restart_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} restart ".format(service_manager='service', service=service)) exec_cmd("{service_manager} {service} restart ".format(service_manager='service', service=service))
else: else:
# look for 'service_manager' and 'service_manager_command' in config.json # look for 'service_manager' and 'service_manager_command' in environment
config = get_config() service_manager = os.environ.get("BENCH_SERVICE_MANAGER")
service_manager = config.get("service_manager")
if service_manager: if service_manager:
service_manager_command = (config.get("service_manager_command") service_manager_command = (os.environ.get("BENCH_SERVICE_MANAGER_COMMAND")
or "{service_manager} restart {service}").format(service_manager=service_manager, service=service) or "{service_manager} restart {service}").format(service_manager=service_manager, service=service)
exec_cmd(service_manager_command) exec_cmd(service_manager_command)