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