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