sonic-buildimage/files/build_templates/swss.service.j2

42 lines
1.3 KiB
Plaintext
Raw Normal View History

[Unit]
Description=switch state service
Requires=database.service
After=database.service
[Service]
User=root
# Wait for redis server start before database clean
ExecStartPre=/bin/bash -c "while true; do if [ \"$(/usr/bin/docker exec database redis-cli ping)\" == \"PONG\" ]; then break; fi; sleep 1; done"
ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB
{% if sonic_asic_platform == 'mellanox' %}
ExecStartPre=/etc/init.d/sxdkernel start
ExecStartPre=/usr/bin/mst start
ExecStartPre=/etc/mlnx/msn2700 start
{% elif sonic_asic_platform == 'cavium' %}
ExecStartPre=-/etc/init.d/xpnet.sh stop
ExecStartPre=/etc/init.d/xpnet.sh start
{% endif %}
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
ExecStartPre=/usr/bin/syncd.sh start
ExecStart=/usr/bin/{{docker_container_name}}.sh attach
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
ExecStopPost=/usr/bin/syncd.sh stop
{% if sonic_asic_platform == 'mellanox' %}
ExecStopPost=/etc/mlnx/msn2700 stop
ExecStopPost=/etc/init.d/sxdkernel stop
ExecStopPost=/usr/bin/mst stop
{% elif sonic_asic_platform == 'cavium' %}
ExecStopPost=/etc/init.d/xpnet.sh stop
ExecStopPost=/etc/init.d/xpnet.sh start
{% endif %}
[Install]
WantedBy=multi-user.target