summaryrefslogtreecommitdiff
blob: 97b9ccdc92f1dd28791ee877a2d49987e767b60f (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
#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

depend() {
	use dns
}

start() {
	ebegin "Starting bareos storage daemon"
	# g+w until #631598 is resolved
	checkpath -d -m 0770 -o root:bareos /run/bareos
	start-stop-daemon --start --quiet --exec /usr/sbin/bareos-sd \
		-- ${SD_OPTIONS}
	# harden pid file until #631598 is resolved
	ewaitfile 10 /run/bareos/bareos-sd.9103.pid
	chown root:bareos /run/bareos/bareos-sd.9103.pid
	eend $?
}

stop() {
	ebegin "Stopping bareos storage daemon"
	# check pid file until #631598 is resolved
	if [[ $(stat -c %U /run/bareos/bareos-sd.9103.pid) != "root" ]]; then
		eerror "SECURITY ALERT: pid file is not root owned anymore?! (see #631598)"
	else
		start-stop-daemon --stop --quiet --pidfile /run/bareos/bareos-sd.9103.pid
	fi
	eend $?
}