up to 1.13.4
[packages/sssd.git] / sssd.init
CommitLineData
d1d78d42 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#
d1d78d42 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.
24if 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
29else
30 exit 0
31fi
32
33start() {
34 # Check if the service is already running?
6b0861e9 35 if [ -f /var/lock/subsys/sssd ]; then
d1d78d42 36 msg_already_running "System Security Services Daemon"
6b0861e9 37 return
d1d78d42 38 fi
6b0861e9
ER
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
d1d78d42 44}
45
46stop() {
6b0861e9
ER
47 if [ ! -f /var/lock/subsys/sssd ]; then
48 msg_not_running "System Security Services Daemon"
49 return
50 fi
d1d78d42 51
6b0861e9
ER
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
d1d78d42 60 else
6b0861e9 61 fail
d1d78d42 62 fi
6b0861e9
ER
63
64 rm -f /var/lock/subsys/sssd
d1d78d42 65}
66
67condrestart() {
6b0861e9 68 if [ ! -f /var/lock/subsys/sssd ]; then
d1d78d42 69 msg_not_running "System Security Services Daemon"
70 RETVAL=$1
6b0861e9 71 return
d1d78d42 72 fi
6b0861e9
ER
73
74 stop
75 start
d1d78d42 76}
77
78RETVAL=0
79# See how we were called.
80case "$1" in
81 start)
6b0861e9 82 start
d1d78d42 83 ;;
84 stop)
6b0861e9 85 stop
d1d78d42 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
104esac
105
106exit $RETVAL
This page took 0.046251 seconds and 4 git commands to generate.