2021-01-27 14:44:07 +00:00
|
|
|
job "java_sleep" {
|
|
|
|
datacenters = ["dc1"]
|
2021-01-27 20:49:47 +00:00
|
|
|
type = "batch"
|
2021-01-27 14:44:07 +00:00
|
|
|
|
|
|
|
group "java" {
|
|
|
|
|
|
|
|
task "build" {
|
|
|
|
lifecycle {
|
2021-01-27 20:49:47 +00:00
|
|
|
hook = "prestart"
|
2021-01-27 14:44:07 +00:00
|
|
|
sidecar = false
|
|
|
|
}
|
|
|
|
|
|
|
|
driver = "exec"
|
|
|
|
config {
|
|
|
|
command = "javac"
|
2021-01-27 20:49:47 +00:00
|
|
|
args = ["-d", "${NOMAD_ALLOC_DIR}", "local/Sleep.java"]
|
2021-01-27 14:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
destination = "local/Sleep.java"
|
2021-01-27 20:49:47 +00:00
|
|
|
data = <<EOH
|
2021-01-27 14:44:07 +00:00
|
|
|
public class Sleep {
|
|
|
|
public static void main(String... s) throws Exception {
|
|
|
|
Thread.sleep(30000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOH
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "sleep" {
|
|
|
|
driver = "java"
|
|
|
|
config {
|
|
|
|
class_path = "${NOMAD_ALLOC_DIR}"
|
2021-01-27 20:49:47 +00:00
|
|
|
class = "Sleep"
|
2021-01-27 14:44:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|