]> git.pld-linux.org Git - packages/sssd.git/blob - sssd.init
- up to 1.12.3
[packages/sssd.git] / sssd.init
1 #!/bin/sh
2 #
3 # sssd  System Security Services Daemon
4 #
5 # chkconfig:    2345 84 16
6 #
7 # description:  Cache for LDAP and Kerberos credentials for disconnected use
8 #
9 # processname:  sssd
10 # config:       /etc/sssd/sssd.conf
11 # pidfile:      /var/lib/sssd/sssd.pid
12 #
13 # $Id$
14
15 # Source function library
16 . /etc/rc.d/init.d/functions
17
18 # Get network config
19 . /etc/sysconfig/network
20
21 # Get service config - may override defaults
22 [ -f /etc/sysconfig/sssd ] && . /etc/sysconfig/sssd
23
24 # Check that networking is up.
25 if is_yes "${NETWORKING}"; then
26         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
27                 msg_network_down "System Security Services Daemon"
28                 exit 1
29         fi
30 else
31         exit 0
32 fi
33
34 start() {
35         # Check if the service is already running?
36         if [ -f /var/lock/subsys/sssd ]; then
37                 msg_already_running "System Security Services Daemon"
38                 return
39         fi
40
41         msg_starting "System Security Services Daemon"
42         daemon --fork /usr/sbin/sssd --defaults-file=/etc/sssd/sssd.conf
43         RETVAL=$?
44         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sssd
45 }
46
47 stop() {
48         if [ ! -f /var/lock/subsys/sssd ]; then
49                 msg_not_running "System Security Services Daemon"
50                 return
51         fi
52
53         # Stop daemons.
54         msg_stopping "System Security Services Daemon"
55         /sbin/start-stop-daemon -q --stop \
56                 --retry TERM/600/KILL/10 \
57                 -s TERM --pidfile /var/lib/sssd/sssd.pid
58         local result=$?
59         if [ "$result" -eq 0 ]; then
60                 ok
61         else
62                 fail
63         fi
64
65         rm -f /var/lock/subsys/sssd
66 }
67
68 condrestart() {
69         if [ ! -f /var/lock/subsys/sssd ]; then
70                 msg_not_running "System Security Services Daemon"
71                 RETVAL=$1
72                 return
73         fi
74
75         stop
76         start
77 }
78
79 RETVAL=0
80 # See how we were called.
81 case "$1" in
82   start)
83         start
84         ;;
85   stop)
86         stop
87         ;;
88   restart)
89         stop
90         start
91         ;;
92   try-restart)
93         condrestart 0
94         ;;
95   force-reload)
96         condrestart 7
97         ;;
98   status)
99         status sssd
100         RETVAL=$?
101         ;;
102   *)
103         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
104         exit 3
105 esac
106
107 exit $RETVAL
This page took 0.072128 seconds and 3 git commands to generate.