sonic-buildimage/files/build_templates/swss.service.j2
lguohan 0ed9b3ce28 [platform]: remove sku from build parameter (#350)
different sku will be contained in a single one sonic image.
no longer need to specify sku at the build time
2017-03-01 17:05:13 -08:00

42 lines
1.4 KiB
Django/Jinja

[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 %}
# systemd allows only one parent process within service,
# so we spawn both dockers from single bash parent
ExecStart=/bin/bash -c "/usr/bin/{{docker_container_name}}.sh start & /usr/bin/syncd.sh start & wait -n 0"
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