blob: 6bb0a1097f25e5caabcd0bd015b7f488f14517d6 (
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
47
|
#!/sbin/openrc-run
# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
depend() {
after localmount
}
check_key() {
[ -s "${KEYFILE}" ] && return 0
local old_umask=$(umask)
local ret
umask 037
dd if=/dev/urandom bs=1024 count=1 of="${KEYFILE}" 2>/dev/null; ret=$?
umask $old_umask
return $ret
}
start() {
ebegin "Starting munged"
if ! check_key; then
eerror "Failed to create munge key"
eend 1 && exit 1
fi
checkpath -d -m 755 -o munge:munge /var/run/munge
checkpath -d -m 711 -o munge:munge /var/lib/munge
checkpath -d -m 700 -o munge:munge /var/log/munge
checkpath -f -m 600 -o munge:munge "${KEYFILE}"
start-stop-daemon -S /usr/sbin/munged \
--user munge \
--group munge \
--pidfile /var/run/munge/munged.pid \
-- \
--key-file="${KEYFILE}" \
--group-check-mtime="${GROUP_CHECK_MTIME}" \
--group-update-time="${GROUP_UPDATE_TIME}" \
--num-threads="${NUM_THREADS}"
eend ${?}
}
stop() {
ebegin "Stopping munged"
start-stop-daemon -K /usr/sbin/munged \
--pidfile /var/run/munge/munged.pid
eend ${?}
}
|