User Tools

Site Tools


hannibal:fds-init-script

An init.d script for the Fedora-directory-server-1.0.x on Debian-4.0

#!/bin/sh -e

# Start or stop Fedora Directory Server
#
# Olivier Brugman (Pref Sourcing)

NAME=FDS
DESC="Fedora Directory Server"
DEFAULTS="/etc/default/fds"
PATH=/bin:/usr/bin:/sbin:/usr/sbin

# Source defaults file; edit that file to configure this script
if [ -e "${DEFAULTS}" ]; then
    . "${DEFAULTS}"
fi

# If the daemon is not to be started, then exit
if [ "${START}" != "yes" ]; then
   echo "${DESC} is not to be autostarted. Check ${DEFAULTS}."
   exit 0
fi

case "$1" in
    start)
        echo "Starting ${DESC}: "
        # Check if fds is already running
        if [ -e "${PIDFILE}" ]; then
           echo "PID file "${PIDFILE}" exists, is fds already running?"
           exit 0
        fi
        ${SLAPDDIR}/start-slapd
        echo "."
    ;;

    stop)
        echo "Stopping ${DESC}: "
        ${SLAPDDIR}/stop-slapd
        echo "."
    ;;

    restart)
        echo "Restarting ${DESC}: "
        ${SLAPDDIR}/restart-slapd
        echo "."
    ;;

    monitor)
        if ps -ef | pgrep ns-slapd 1> /dev/null
        then
           ${SLAPDDIR}/monitor
        else
           echo "ns-slapd is not running"
        fi
        echo "."
    ;;

    check|status)
        if ps -ef | pgrep ns-slapd 1> /dev/null
        then
           echo "ns-slapd is running"
        else
           echo "ns-slapd is not running"
        fi
        echo "."
    ;;

    *)
        echo "Usage: /etc/init.d/fds {start|stop|restart|monitor||check|status}"
        exit 1
    ;;
esac

exit 0
hannibal/fds-init-script.txt · Last modified: 2008/06/26 07:26 by Olivier Brugman