summaryrefslogtreecommitdiff
path: root/network/krb5/rc.krb5kdc
blob: 6829e12ab5258c7ebc48ffa0be0e67b933da2ece (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 V5 KDC init script
#
# Copyright (C) 2017 Jason Graham <jgraha8@gmail.com>
#

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

# Stop krb5kdc:
krb5kdc_stop() {
    echo "Stopping krb5kdc..."
    killall -e -q krb5kdc
}

# Restart krb5kdc:
krb5kdc_restart() {
    krb5kdc_stop
    sleep 1
    krb5kdc_start
}

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

case "$1" in
    'start')
	krb5kdc_start
	;;
    'stop')
	krb5kdc_stop
	;;
    'restart')
	krb5kdc_restart
	;;
    'status')
	krb5kdc_status
	;;
    *)
	echo "usage $0 start|stop|restart|status"
esac