blob: 5bbb85103bf47c7c0df50d66e698900fe0b7dfe7 (
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
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#! /bin/sh
# /etc/init.d/linbss-ldapd script for starting and stopping nslcd
# Copyright (C) 2006 West Consulting
# Copyright (C) 2006 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
### BEGIN INIT INFO
# Provides: nslcd
# Required-Start: $local_fs $syslog
# Required-Stop: $local_fs $syslog
# Should-Start: $remote_fs $network
# Should-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nss-ldapd connection daemon
# Description: nslcd is a LDAP connection daemon that is used to
# do LDAP queries for the NSS libraries.
### END INIT INFO
PATH=/bin:/usr/bin:/sbin:/usr/sbin
NSLCD_BIN=/usr/sbin/nslcd
NSLCD_DESC="nss-ldapd connection daemon"
NSLCD_CFG=/etc/nss-ldapd.conf
[ -x "$NSLCD_BIN" ] || exit 0
[ -f "$NSLCD_CFG" ] || exit 0
. /lib/lsb/init-functions
NSLCD_STATEDIR=/var/run/nslcd
NSLCD_PIDFILE=$NSLCD_STATEDIR/nslcd.pid
case "$1" in
start)
[ -d "$NSLCD_STATEDIR" ] || mkdir "$NSLCD_STATEDIR"
log_daemon_msg "Starting $NSLCD_DESC" "nslcd"
start-stop-daemon --start \
--pidfile $NSLCD_PIDFILE \
--startas $NSLCD_BIN
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $NSLCD_DESC" "nslcd"
start-stop-daemon --stop \
--pidfile $NSLCD_PIDFILE \
--name nslcd
log_end_msg $?
[ -n "$NSLCD_PIDFILE" ] && rm -f $NSLCD_PIDFILE
;;
restart|force-reload)
[ -d "$NSLCD_STATEDIR" ] || mkdir "$NSLCD_STATEDIR"
log_daemon_msg "Restarting $NSLCD_DESC" "nslcd"
start-stop-daemon --stop --quiet --retry 10 \
--pidfile $NSLCD_PIDFILE \
--name nslcd
[ -n "$NSLCD_PIDFILE" ] && rm -f $NSLCD_PIDFILE
start-stop-daemon --start \
--pidfile $NSLCD_PIDFILE \
--startas $NSLCD_BIN
log_end_msg $?
;;
status)
if [ -f "$NSLCD_PIDFILE" ]
then
if kill -s 0 `cat $NSLCD_PIDFILE` > /dev/null 2>&1
then
log_success_msg "nslcd running (pid `cat $NSLCD_PIDFILE`)"
exit 0
else
log_success_msg "nslcd stopped"
exit 1
fi
else
log_success_msg "nslcd stopped"
exit 3
fi
;;
*)
log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}"
exit 1
;;
esac
exit 0
|