aboutsummaryrefslogtreecommitdiffstats
path: root/testing/nomad/nomad.initd
blob: 05949fd87acaddd4af32482e0b7379801e06c288 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/sbin/openrc-run
name="Nomad"
description="An easy-to-use, flexible, and performant workload orchestrator"
description_healthcheck="Check health status"
description_reload="Reload configuration"

extra_started_commands="healthcheck reload"

command="/usr/sbin/${RC_SVCNAME}"
command_args="${nomad_opts}"
command_user="root:root"

supervisor=supervise-daemon
output_log="/var/log/${RC_SVCNAME}.log"
error_log="/var/log/${RC_SVCNAME}.log"
respawn_max=0
respawn_delay=10
healthcheck_timer=60

depend() {
	need net
	after firewall
}

start_pre() {
	checkpath -f -m 0644 -o "$command_user" "$output_log" "$error_log"
}

healthcheck() {
	$command agent-info > /dev/null 2>&1
}

reload() {
	start_pre \
		&& ebegin "Reloading $RC_SVCNAME configuration" \
		&& $supervisor "$RC_SVCNAME" --signal HUP
	eend $?
}