github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/e2e/consul/input/checks_task_restart.nomad (about) 1 job "task_check" { 2 datacenters = ["dc1"] 3 type = "service" 4 5 constraint { 6 attribute = "${attr.kernel.name}" 7 value = "linux" 8 } 9 10 group "task_check" { 11 count = 1 12 13 restart { 14 attempts = 2 15 delay = "1s" 16 interval = "5m" 17 mode = "fail" 18 } 19 20 task "fail" { 21 22 service { 23 name = "task-service-1" 24 25 # this check should always time out and so the service 26 # should not be marked healthy 27 check { 28 name = "always-dead" 29 type = "script" 30 interval = "2s" 31 timeout = "1s" 32 command = "sleep" 33 args = ["10"] 34 35 check_restart { 36 limit = 2 37 grace = "5s" 38 ignore_warnings = false 39 } 40 41 } 42 } 43 44 driver = "raw_exec" 45 46 config { 47 command = "bash" 48 args = ["-c", "sleep 15000"] 49 } 50 } 51 52 53 task "ok" { 54 driver = "raw_exec" 55 56 config { 57 command = "bash" 58 args = ["-c", "sleep 15000"] 59 } 60 } 61 62 } 63 }