summaryrefslogtreecommitdiff
path: root/source/n/nss-pam-ldapd/rc.nss-pam-ldapd
blob: 7a4252a38ea48735fe35ed865a31bfe32efcdd6e (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
#!/bin/sh
#
# rc.nss-pam-ldapd:  start/stop/restart nslcd
#
# nslcd is a daemon that will do LDAP queries for local processes that want
# to do user, group, and other naming lookups (NSS), or do user authentication,
# authorization, or password modification (PAM).

nslcd_start() {
  if [ -x /usr/sbin/nslcd -a -r /etc/nslcd.conf ]; then
    # Ensure /run directory exists:
    mkdir -p /run/nslcd
    echo "Starting local LDAP name service daemon:  /usr/sbin/nslcd"
    /usr/sbin/nslcd
  fi
}

nslcd_stop() {
  echo "Stopping local LDAP name service daemon."
  killall --ns $$ nslcd
}

case "$1" in
'start')
  nslcd_start
  ;;
'stop')
  nslcd_stop
  ;;
'restart')
  nslcd_stop
  sleep 2
  nslcd_start
  ;;
*)
  echo "usage $0 start|stop|restart"
esac