summaryrefslogtreecommitdiff
path: root/net-im/eturnal/files/eturnal.initd
blob: 5d567d5a2b4325c760d4bd5053df19dcf102fd67 (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
39
40
41
42
43
44
45
46
#!/sbin/openrc-run
# shellcheck shell=sh
#
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

extra_started_commands="reload"
command="/usr/sbin/eturnalctl"
command_args="foreground"
command_user="eturnal:turnserver"
command_background=1
pidfile="/run/eturnal.pid"
capabilities="^cap_net_bind_service"
healthcheck_delay=300
healthcheck_timer=60

depend() {
	need epmd net
	after firewall
}

healthcheck() {
	"${command}" ping >/dev/null
}

start_post() {
	local i=10
	while [ $((i = i - 1)) -gt 0 ]; do
		healthcheck && return 0
		sleep 1
	done

	return 1
}

stop() {
	ebegin "Stopping ${RC_SVCNAME}"
	"${command}" stop
	eend $?
}

reload() {
	ebegin "Reloading ${RC_SVCNAME}"
	"${command}" reload
	eend $?
}