blob: 5252a2d600df4003b7bc99dfae8ef15ac1748895 (
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
48
49
|
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
daemon_name=munge
USER=munge
[ -x /etc/default/munge ] && . /etc/default/munge
PID=`pidof -o %PPID /usr/bin/munged`
case "$1" in
start)
stat_busy "Starting MUNGE daemon"
VARRUNDIR="/run/munge"
if [ ! -d "$VARRUNDIR" ]; then
mkdir -m 755 -p "$VARRUNDIR"
[ -n "$USER" ] && chown "$USER" "$VARRUNDIR"
fi
[ -z "$PID" ] && su "$USER" -c /usr/bin/munged "$DAEMON_ARGS" 2>&1
if [ $? -gt 0 ] ; then
stat_fail
else
add_daemon $daemon_name # create the 'state' dir
stat_done
fi
;;
stop)
stat_busy "Stopping MUNGE daemon"
[ "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon $daemon_name # remove the 'state' dir
stat_done
fi
;;
restart)
$0 stop
sleep 5
$0 start
;;
status)
stat_busy "Checking MUNGE status"
ck_status $daemon_name
;;
*)
echo "usage: $0 {start|stop|restart|status}"
esac
exit 0
|