mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
78 lines
1.7 KiB
Bash
Executable file
78 lines
1.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
. /etc/rc.conf
|
|
. /etc/rc.d/functions
|
|
|
|
[ -f "/etc/default/slapd" ] && . /etc/default/slapd
|
|
|
|
if [ -z "$SLURPD_START" ] || [ "$SLURPD_START" = "auto" ]; then
|
|
if grep -q '^replica' /etc/openldap/slapd.conf > /dev/null 2>&1 ; then
|
|
SLURPD_START=yes
|
|
else
|
|
SLURPD_START=no
|
|
fi
|
|
fi
|
|
|
|
PID=`pidof -o %PPID /usr/sbin/slapd`
|
|
SLURPD_PID=`pidof -o %PPID /usr/sbin/slurpd`
|
|
case "$1" in
|
|
start)
|
|
stat_busy "Starting OpenLDAP"
|
|
if [ -z "$PID" ] && [ -z "$SLURPD_PID" ]; then
|
|
SLAPD_OPTIONS="-f /etc/openldap/slapd.conf $SLAPD_OPTIONS"
|
|
SLURPD_OPTIONS="-f /etc/openldap/slapd.conf $SLURPD_OPTIONS"
|
|
if [ -z "$SLAPD_SERVICES" ]; then
|
|
/usr/sbin/slapd $SLAPD_OPTIONS
|
|
else
|
|
/usr/sbin/slapd -h "$SLAPD_SERVICES" $SLAPD_OPTIONS
|
|
fi
|
|
if [ $? -gt 0 ]; then
|
|
stat_fail
|
|
else
|
|
stat_done
|
|
if [ "$SLURPD_START" != no ]; then
|
|
stat_busy "Starting OpenLDAP Replication service"
|
|
/usr/sbin/slurpd $SLURPD_OPTIONS
|
|
if [ $? -gt 0 ]; then
|
|
stat_fail
|
|
else
|
|
stat_done
|
|
fi
|
|
fi
|
|
fi
|
|
add_daemon slapd
|
|
else
|
|
stat_fail
|
|
fi
|
|
;;
|
|
stop)
|
|
if [ "$SLURPD_START" != no ]; then
|
|
stat_busy "Stopping OpenLDAP Replication Service"
|
|
[ ! -z "$SLURPD_PID" ] && kill "$SLURPD_PID" &> /dev/null
|
|
if [ $? -gt 0 ]; then
|
|
stat_fail
|
|
else
|
|
stat_done
|
|
fi
|
|
fi
|
|
|
|
stat_busy "Stopping OpenLDAP"
|
|
[ ! -z "$PID" ] && kill $PID &> /dev/null
|
|
if [ $? -gt 0 ]; then
|
|
stat_fail
|
|
else
|
|
rm -f /var/run/slapd.pid
|
|
rm -f /var/run/slapd.args
|
|
rm_daemon slapd
|
|
stat_done
|
|
fi
|
|
;;
|
|
restart)
|
|
$0 stop
|
|
sleep 1
|
|
$0 start
|
|
;;
|
|
*)
|
|
echo "usage: $0 {start|stop|restart}"
|
|
esac
|
|
exit 0
|