summaryrefslogtreecommitdiffstats
path: root/debian/sssd-common.sssd.init
blob: 390a6e2eec4b6fa0f2c58e7c22a4c722a1cd17f3 (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
#!/bin/sh
### BEGIN INIT INFO
# Provides:          sssd
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: System Security Services Daemon
# Description:       Provides a set of daemons to manage access to
#                    remote directories and authentication
#                    mechanisms. It provides an NSS and PAM interface
#                    toward the system and a pluggable backend system
#                    to connect to multiple different account sources.
### END INIT INFO
# start on filesystem
# stop on runlevel [06]

DESCRIPTION="System Security Services Daemon"
PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=sssd
DAEMON_OPTS=""
DAEMON=/usr/sbin/$NAME
PIDFILE=/var/run/$NAME.pid

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

if [ -f /etc/default/sssd ] ; then
    . /etc/default/sssd
fi

initdmain() {
    case "$1" in
        start)
            [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESCRIPTION" "$NAME"
            start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
            RC=$?
            case "$RC" in
                0)
                    [ "$VERBOSE" != no ] && log_end_msg $RC
                    ;;
                *)
                # Report error also when VERBOSE=no
                    log_daemon_msg "Starting $DESCRIPTION" "$NAME"
                    log_end_msg $RC
                    ;;
            esac
            ;;
        stop)
            [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESCRIPTION" "$NAME"
            killproc -p $PIDFILE $DAEMON
            RC=$?
            case "$RC" in
                0)
                    [ "$VERBOSE" != no ] && log_end_msg $RC
                    ;;
                *)
                # Report error also when VERBOSE=no
                    log_daemon_msg "Stopping $DESCRIPTION" "$NAME"
                    log_end_msg $RC
                    ;;
            esac
            ;;
        force-reload|restart)
            $0 stop
            $0 start
            ;;
        status)
            status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
            ;;
        *)
            echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload|status}"
            exit 1
            ;;
    esac
}

initdmain $@

exit 0