summaryrefslogtreecommitdiffstats
path: root/src/credmonger.init
blob: baf2eeb05c934ab514cc05ff42ced8b73103cd91 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
#
# credmonger:	maintain Kerberos credentials for other processes
#
# chkconfig: - 18 86
# description:  This is a daemon which handles obtaining and refreshing \
#		Kerberos credentials on behalf of other processes which \
#		may unknowingly require such credentials to function \
#		properly in your environment.
# processname: /usr/sbin/credmonger
# pidfile:     /var/run/credmonger.pid
#
### BEGIN INIT INFO
# Provides: credmonger
# Required-Start: $syslog
# Default-Stop: 0 1 6
# Short-Description: maintain Kerberos credentials for other processes
# Description:  This is a daemon which handles obtaining and refreshing \
#		Kerberos credentials on behalf of other processes which \
#		may unknowingly require such credentials to function \
#		properly in your environment.
### END INIT INFO

# Source function library.
. /etc/init.d/functions

# Source an auxiliary options file if we have one, and pick up whatever it has.
[ -r /etc/sysconfig/credmonger ] && . /etc/sysconfig/credmonger

RETVAL=0
program=/usr/sbin/credmonger
prog=${program##*/}
pidfile=/var/run/credmonger.pid
lockfile=/var/lock/subsys/credmonger

start () {
    echo -n $"Starting $prog: "
    daemon ${program} -p ${pidfile}
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch ${lockfile}
    return $RETVAL
}

stop () {
    echo -n $"Stopping $prog: "
    killproc -p ${pidfile} ${program}
    RETVAL=$?
    if [ $RETVAL -eq 0 ]; then
        rm -f ${lockfile}
       	success $"$prog shutdown"
    else
       	failure $"$prog shutdown"
    fi
    echo
    return $RETVAL
}

restart() {
    stop
    start
}

# See how we were called.
case "$1" in
    start)
	start
	RETVAL=$?
	;;
    stop)
	stop
	RETVAL=$?
	;;
    status)
	status $prog
	RETVAL=$?
	;;
    restart)
	restart
	RETVAL=$?
	;;
    condrestart)
	[ -e ${lockfile} ] && restart
	RETVAL=$?
	;;
    force-reload|reload)
    	echo -n $"Reloading $prog: "
    	killproc -p ${pidfile} ${program} -HUP
    	RETVAL=0
    	echo
	;;
    *)
	echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
	RETVAL=1
	;;
esac
exit $RETVAL