github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/e2e/consul/input/checks_task.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 task "test" { 14 service { 15 name = "task-service-1" 16 17 check { 18 name = "alive-1" 19 type = "script" 20 interval = "2s" 21 timeout = "2s" 22 command = "echo" 23 args = ["alive-1"] 24 } 25 } 26 27 service { 28 name = "task-service-2" 29 30 check { 31 name = "alive-2a" 32 type = "script" 33 interval = "2s" 34 timeout = "2s" 35 command = "echo" 36 args = ["alive-2a"] 37 } 38 39 # the file expected by this check will not exist when started, 40 # so the check will error-out and be in a warning state until 41 # it's been created 42 check { 43 name = "alive-2b" 44 type = "script" 45 interval = "2s" 46 timeout = "2s" 47 command = "cat" 48 args = ["${NOMAD_TASK_DIR}/alive-2b"] 49 } 50 } 51 52 service { 53 name = "task-service-3" 54 55 # this check should always time out and so the service 56 # should not be marked healthy 57 check { 58 name = "always-dead" 59 type = "script" 60 interval = "2s" 61 timeout = "1s" 62 command = "sleep" 63 args = ["10"] 64 } 65 } 66 67 driver = "raw_exec" 68 69 config { 70 command = "bash" 71 args = ["-c", "sleep 15000"] 72 } 73 } 74 } 75 }