2017-01-29 13:33:33 -06:00
|
|
|
[Unit]
|
2017-02-03 23:35:48 -06:00
|
|
|
Description=switch state service container
|
2017-01-29 13:33:33 -06:00
|
|
|
Requires=database.service
|
|
|
|
After=database.service
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
User={{ sonicadmin_user }}
|
2017-02-09 08:52:20 -06:00
|
|
|
# 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"
|
2017-02-03 23:35:48 -06:00
|
|
|
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
|
2017-01-29 13:33:33 -06:00
|
|
|
ExecStart=/usr/bin/{{docker_container_name}}.sh start
|
|
|
|
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
|
|
|
|
ExecStopPost=/usr/bin/syncd.sh stop
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|