|
Line 0
Link Here
|
|
|
1 |
#!/sbin/openrc-run |
| 2 |
# Copyright 1999-2018 Gentoo Authors |
| 3 |
# Distributed under the terms of the GNU General Public License v2 |
| 4 |
|
| 5 |
depend() { |
| 6 |
after localmount |
| 7 |
} |
| 8 |
|
| 9 |
check_key() { |
| 10 |
[ -s "${KEYFILE}" ] && return 0 |
| 11 |
local old_umask=$(umask) |
| 12 |
local ret |
| 13 |
umask 037 |
| 14 |
dd if=/dev/urandom bs=1024 count=1 of="${KEYFILE}" 2>/dev/null; ret=$? |
| 15 |
umask $old_umask |
| 16 |
return $ret |
| 17 |
} |
| 18 |
|
| 19 |
start() { |
| 20 |
ebegin "Starting munged" |
| 21 |
if ! check_key; then |
| 22 |
eerror "Failed to create munge key" |
| 23 |
eend 1 && exit 1 |
| 24 |
fi |
| 25 |
checkpath -d -m 755 -o munge:munge /var/run/munge |
| 26 |
checkpath -d -m 711 -o munge:munge /var/lib/munge |
| 27 |
checkpath -d -m 700 -o munge:munge /var/log/munge |
| 28 |
checkpath -f -m 600 -o munge:munge "${KEYFILE}" |
| 29 |
start-stop-daemon -S /usr/sbin/munged \ |
| 30 |
--user munge \ |
| 31 |
--group munge \ |
| 32 |
--pidfile /var/run/munge/munged.pid \ |
| 33 |
-- \ |
| 34 |
--key-file="${KEYFILE}" \ |
| 35 |
--group-check-mtime="${GROUP_CHECK_MTIME}" \ |
| 36 |
--group-update-time="${GROUP_UPDATE_TIME}" \ |
| 37 |
--num-threads="${NUM_THREADS}" |
| 38 |
eend ${?} |
| 39 |
} |
| 40 |
|
| 41 |
stop() { |
| 42 |
ebegin "Stopping munged" |
| 43 |
start-stop-daemon -K /usr/sbin/munged \ |
| 44 |
--pidfile /var/run/munge/munged.pid |
| 45 |
eend ${?} |
| 46 |
} |
| 47 |
|