cron - Does Docker support restarting containers every X seconds -
i have logstash container keeps 2 data sources sync. when runs, queries non-synced entries in 1 database , posts them other. run container every 10 seconds.
what have been doing specify --restart=always
when container exits, restarts itself, around takes around 5 seconds, bit use case.
does docker support want achieve (waiting x seconds between restarts, or kind of scheduling) or should remove restart policy , schedule cron run every 10 seconds?
if container exits succesfully, restarted --restart=always
an ever increasing delay (double previous delay, starting @ 100 milliseconds) added before each restart prevent flooding server. means daemon wait 100 ms, 200 ms, 400, 800, 1600, , on until either on-failure limit hit, or when docker stop or docker rm -f container.
here part guess:
if container restarted (the container started , runs @ least 10 seconds), delay reset default value of 100 ms.
what can is:
- restart container cron every 10 seconds
- configure cron inside container , launch logstash every 10 seconds
- use shell script which, in loop, launch logstash sleep 10
- maybe logstash has built-in? (i know example jdbc-input-plugin has schedule params)
Comments
Post a Comment