Skip to content

Commit

Permalink
Merge pull request sonic-net#288 from pavel-shirshov/pavelsh/systemd
Browse files Browse the repository at this point in the history
Use systemctl utility instead of service utility in config
  • Loading branch information
pavel-shirshov authored Jul 24, 2018
2 parents d1675c6 + 7ebdb4c commit 7311bff
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
45 changes: 27 additions & 18 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion config/mlnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down

0 comments on commit 7311bff

Please sign in to comment.