summaryrefslogtreecommitdiff
path: root/user/mumble/murmur.initd
blob: dfbc46821102407598bdd026dffb1d436ac1cc62 (plain) (blame)
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
#!/sbin/openrc-run
description="Mumble VoIP server"
command="/usr/bin/murmurd"
: "${config:=/etc/murmur.ini}"
: "${command_args:=-ini $config}"

extra_started_commands="reload"
description_reload="Reload TLS settings"

# As of 1.3.2 murmur will make the PID file *after* it switches to the
# unprivileged user, which is bad. So make start-stop-daemon handle the
# PID file and user switching instead.
command_background=true
command_args="$command_args -fg"

command_user="$(awk -F= '$1 == "uname" { print $2 }' "$config")"
: "${command_user:=murmur}"

pidfile="$(awk -F= '$1 == "pidfile" { print $2 }' "$config")"
: "${pidfile:=/var/run/$RC_SVCNAME.pid}"

# Ignores logfile when -fg is used.
logfile="$(awk -F= '$1 == "logfile" { print $2 }' "$config")"
: "${logfile:=/var/log/murmur.log}"
start_stop_daemon_args="--stdout $logfile --stderr $logfile"

start_pre() {
	checkpath -m 0640 -f -o "$command_user" "$logfile"
}

reload() {
	ebegin "Reloading $RC_SVCNAME TLS settings"
	start-stop-daemon --signal USR1 --pidfile "$pidfile"
	eend $?
}