[Date Prev][Date Next] [Chronological] [Thread] [Top]

SYSV initscript for slapd (ITS#548)



Full_Name: Troy Engel
Version: any
OS: any SYSV R4
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (209.204.160.45)


Below is a SYSV initscript for the /etc/init.d tree of most OSes; it's been
tested on Solaris 2.x and Linux, so it should work anywhere a basic Bourne shell
is in place.  You can stop, start, and restart the slapd daemon.

== begin slapd.sysv ==
#!/bin/sh
# tengel@fluid.com
# stop/start slapd in a nice manner
 
SLAPD_BIN=/usr/local/libexec/slapd
SLAPD_PID=/usr/local/var/slapd.pid

case "$1" in
 
'start')
    if test -r $SLAPD_PID && kill -0 `cat $SLAPD_PID`; then
      echo "Already running according to $SLAPD_PID. Not started."
    else
      $SLAPD_BIN
    fi
    ;;
'stop')
    [ -f $SLAPD_PID ] || exit 0
    kill -TERM `cat $SLAPD_PID`
    rm -f $SLAPD_PID
    ;;
'restart')
    $0 stop
    $0 start
    ;;
*)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
  
esac
 
exit 0
== end slapd.sysv ==

-te