updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / munge / arch_munge.init
blob9a1600c05b7442916b8ffc0ced72bb8d111df43c
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 daemon_name=munge
7 USER=munge
8 [ -x /etc/default/munge ] && . /etc/default/munge
10 PID=`pidof -o %PPID /usr/sbin/munged`
11 case "$1" in
12 start)
13 stat_busy "Starting MUNGE daemon"
14 VARRUNDIR="/run/munge"
15 if [ ! -d "$VARRUNDIR" ]; then
16 mkdir -m 755 -p "$VARRUNDIR"
17 [ -n "$USER" ] && chown "$USER" "$VARRUNDIR"
19 [ -z "$PID" ] && su "$USER" -c /usr/sbin/munged "$DAEMON_ARGS" 2>&1
20 if [ $? -gt 0 ] ; then
21 stat_fail
22 else
23 add_daemon $daemon_name # create the 'state' dir
24 stat_done
27 stop)
28 stat_busy "Stopping MUNGE daemon"
29 [ "$PID" ] && kill $PID &> /dev/null
30 if [ $? -gt 0 ]; then
31 stat_fail
32 else
33 rm_daemon $daemon_name # remove the 'state' dir
34 stat_done
37 restart)
38 $0 stop
39 sleep 5
40 $0 start
42 status)
43 stat_busy "Checking MUNGE status"
44 ck_status $daemon_name
47 echo "usage: $0 {start|stop|restart|status}"
48 esac
49 exit 0