summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2006-12-16 16:25:15 +0000
committerArthur de Jong <arthur@arthurdejong.org>2006-12-16 16:25:15 +0000
commit4bd692c652a3bf2a7554ca55f858da823401f8f6 (patch)
tree26ab4c682320c86e67a2ee044fd5634461b0bbf9
parent3ffe9ae483fc4523f9d6bd3e0f20d571bf5c5c0a (diff)
ship an init script for starting nslcd
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/libnss_ldapd@157 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--Makefile.am1
-rw-r--r--debian/libnss-ldapd.nslcd.init99
-rwxr-xr-xdebian/rules2
3 files changed, 101 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index d37802e..fed46ec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,6 +29,7 @@ EXTRA_DIST = ChangeLog \
debian/changelog debian/compat debian/config \
debian/control debian/copyright debian/rules \
debian/templates debian/libnss-ldapd.docs \
+ debian/libnss-ldapd.nslcd.init \
debian/libnss-ldapd.postinst \
debian/libnss-ldapd.postrm debian/README.Debian \
debian/po/*.po debian/po/templates.pot \
diff --git a/debian/libnss-ldapd.nslcd.init b/debian/libnss-ldapd.nslcd.init
new file mode 100644
index 0000000..a84e55d
--- /dev/null
+++ b/debian/libnss-ldapd.nslcd.init
@@ -0,0 +1,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 Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 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
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, 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: S 0 1 6
+# Short-Description: NSS-LDAP 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-LDAP connection daemon"
+NSLCD_CFG=/etc/libnss-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 "$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 "$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"
+ 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
diff --git a/debian/rules b/debian/rules
index 9366eb7..910ba01 100755
--- a/debian/rules
+++ b/debian/rules
@@ -81,7 +81,7 @@ binary-arch: build install
dh_installdebconf
dh_installdocs
dh_installexamples
- dh_installinit
+ dh_installinit --name=nslcd
dh_installman
dh_installchangelogs
dh_link