aboutsummaryrefslogtreecommitdiff
path: root/network/krb5/rc.kadmind
blob: 5a5633f1eed726ad1304c84385c0e8e83dc5524d (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
#!/bin/sh
#
# Kerberos KADM5 administration server init script
#
# Copyright (C) 2017 Jason Graham <jgraha8@gmail.com>
#

# Start kadmind:
kadmind_start() {
    CMDLINE="/usr/sbin/kadmind"
    echo -n "Starting kadmind:  $CMDLINE"
    $CMDLINE
    echo
}

# Stop kadmind:
kadmind_stop() {
    echo "Stopping kadmind..."
    killall -e -q kadmind
}

# Restart kadmind:
kadmind_restart() {
    kadmind_stop
    sleep 1
    kadmind_start
}

# Check if kadmind is running
kadmind_status() {
    if [ ! -z "$(ps -e -o command | grep -E -w [/]usr/sbin/kadmind)" ]; then
	echo "kadmind is running."
    else 
	echo "kadmind is stopped."
	exit 1
    fi
}

case "$1" in
    'start')
	kadmind_start
	;;
    'stop')
	kadmind_stop
	;;
    'restart')
	kadmind_restart
	;;
    'status')
	kadmind_status
	;;
    *)
	echo "usage $0 start|stop|restart|status"
esac