diff --git a/config/main.py b/config/main.py index 6b53a1246c..9d65c3fb9b 100755 --- a/config/main.py +++ b/config/main.py @@ -140,26 +140,35 @@ def _abort_if_false(ctx, param, value): ctx.abort() def _stop_services(): - run_command("service dhcp_relay stop", display_cmd=True) - run_command("service swss stop", display_cmd=True) - run_command("service snmp stop", display_cmd=True) - run_command("service lldp stop", display_cmd=True) - run_command("service pmon stop", display_cmd=True) - run_command("service bgp stop", display_cmd=True) - run_command("service teamd stop", display_cmd=True) + services = [ + 'dhcp_relay', + 'swss', + 'snmp', + 'lldp', + 'pmon', + 'bgp', + 'teamd', + ] + for service in services: + run_command("systemctl stop %s" % service, display_cmd=True) def _restart_services(): - run_command("service hostname-config restart", display_cmd=True) - run_command("service interfaces-config restart", display_cmd=True) - run_command("service ntp-config restart", display_cmd=True) - run_command("service rsyslog-config restart", display_cmd=True) - run_command("service swss restart", display_cmd=True) - run_command("service bgp restart", display_cmd=True) - run_command("service teamd restart", display_cmd=True) - run_command("service pmon restart", display_cmd=True) - run_command("service lldp restart", display_cmd=True) - run_command("service snmp restart", display_cmd=True) - run_command("service dhcp_relay restart", display_cmd=True) + services = [ + 'hostname-config', + 'interfaces-config', + 'ntp-config', + 'rsyslog-config', + 'swss', + 'bgp', + 'teamd', + 'pmon', + 'lldp', + 'snmp', + 'dhcp_relay', + ] + for service in services: + run_command("systemctl restart %s" % service, display_cmd=True) + # This is our main entrypoint - the main 'config' command @click.group() diff --git a/config/mlnx.py b/config/mlnx.py index 01292cfb5a..1e47dea7ae 100644 --- a/config/mlnx.py +++ b/config/mlnx.py @@ -46,7 +46,7 @@ SNIFFER_CONF_FILE = '/etc/supervisor/conf.d/mlnx_sniffer.conf' # Command to restart swss service -COMMAND_RESTART_SWSS = 'service swss restart' +COMMAND_RESTART_SWSS = 'systemctl restart swss.service' # global variable SDK_SNIFFER_TARGET_FILE_NAME SDK_SNIFFER_TARGET_FILE_NAME = ''