diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2009-08-31 17:11:53 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2009-08-31 17:11:53 +0200 |
commit | 1a1a3a2a955a0dc188d2b352e6b9135b2dab4275 (patch) | |
tree | 03c0133532ebcfb13f2d3278c427eb464461d961 /debian/nslcd.init | |
parent | 19bf24fc48c1a207b97af3d290895aa059388cb7 (diff) |
split into binary packages libnss-ldapd, libpam-ldapd and nslcd packages, using a patch for libpam-ldap by Steve Langasek <vorlon@debian.org> for the libpam-ldapd package
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@975 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'debian/nslcd.init')
-rw-r--r-- | debian/nslcd.init | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/debian/nslcd.init b/debian/nslcd.init new file mode 100644 index 0000000..866eea3 --- /dev/null +++ b/debian/nslcd.init @@ -0,0 +1,101 @@ +#! /bin/sh + +# /etc/init.d/linbss-ldapd script for starting and stopping nslcd +# Copyright (C) 2006 West Consulting +# Copyright (C) 2006, 2008, 2009 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: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Should-Start: slapd +# X-Start-Before: $mail-transport-agent mail-transport-agent exim4 sendmail nullmailer masqmail citadel cron atd autofs am-utils +# 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 -m 755 "$NSLCD_STATEDIR" ; \ + chown nslcd:nslcd "$NSLCD_STATEDIR" ) + log_daemon_msg "Starting $NSLCD_DESC" "nslcd" + start-stop-daemon --start --oknodo \ + --pidfile $NSLCD_PIDFILE \ + --startas $NSLCD_BIN + log_end_msg $? + ;; +stop) + log_daemon_msg "Stopping $NSLCD_DESC" "nslcd" + start-stop-daemon --stop --oknodo \ + --pidfile $NSLCD_PIDFILE \ + --name nslcd + log_end_msg $? + [ -n "$NSLCD_PIDFILE" ] && rm -f $NSLCD_PIDFILE + ;; +restart|force-reload) + [ -d "$NSLCD_STATEDIR" ] || ( mkdir -m 755 "$NSLCD_STATEDIR" ; \ + chown nslcd:nslcd "$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 |