I am running an OpenLDAP server on my Slackware 12.0. When the
/etc/rc.d/rc.openldap was started from rc.M, all services after the
rc.openldap did not start.
Before the modification, my rc.M reads
Code:
#!/bin/sh
#
# rc.M This file is executed by init(8) when the system is being
# initialized for one of the "multi user" run levels (i.e.
# levels 1 through 6). It usually does mounting of file
# systems et al.
#
......
# Start Apache web server:
if [ -x /etc/rc.d/rc.httpd ]; then
. /etc/rc.d/rc.httpd start
fi
# Start OpenLDAP:
if [ -x /etc/rc.d/rc.openldap ]; then
. /etc/rc.d/rc.openldap start
fi
# Start Samba (a file/print server for Win95/NT machines).
# Samba can be started in /etc/inetd.conf instead.
if [ -x /etc/rc.d/rc.samba ]; then
. /etc/rc.d/rc.samba start
fi
# Start the GPM mouse server:
if [ -x /etc/rc.d/rc.gpm ]; then
. /etc/rc.d/rc.gpm start
fi
# If there are SystemV init scripts for this runlevel, run them.
if [ -x /etc/rc.d/rc.sysvinit ]; then
. /etc/rc.d/rc.sysvinit
fi
# Start the local setup procedure.
if [ -x /etc/rc.d/rc.local ]; then
. /etc/rc.d/rc.local
fi
# All done.
When the /etc/rc.d/rc.openldap started, all services after the rc.openldap, such as rc.samba, rc.gpm, rc.sysvinit did not start.
When I moved the rc.openldap to the end of rc.M, everthing went ok. Does anything wrong with my rc.openldap?
After the modification, the /etc/rc.d/rc.M reads
Code:
#!/bin/sh
#
...
# Start the MySQL database:
if [ -x /etc/rc.d/rc.mysqld ]; then
. /etc/rc.d/rc.mysqld start
fi
# Start Apache web server:
if [ -x /etc/rc.d/rc.httpd ]; then
. /etc/rc.d/rc.httpd start
fi
# Start Samba (a file/print server for Win95/NT machines).
# Samba can be started in /etc/inetd.conf instead.
if [ -x /etc/rc.d/rc.samba ]; then
. /etc/rc.d/rc.samba start
fi
# Start the GPM mouse server:
if [ -x /etc/rc.d/rc.gpm ]; then
. /etc/rc.d/rc.gpm start
fi
# If there are SystemV init scripts for this runlevel, run them.
if [ -x /etc/rc.d/rc.sysvinit ]; then
. /etc/rc.d/rc.sysvinit
fi
# Start the DHCP server.
if [ -x /etc/rc.d/rc.dhcpd ]; then
. /etc/rc.d/rc.dhcpd start
fi
# Start OpenLDAP:
if [ -x /etc/rc.d/rc.openldap ]; then
. /etc/rc.d/rc.openldap start
fi
# Start the local setup procedure.
if [ -x /etc/rc.d/rc.local ]; then
. /etc/rc.d/rc.local
fi
# All done.
Everthing went ok. Does anything wrong with my rc.openldap?
Code:
# /etc/rc.d/rc.openldap
if [ $# -eq 0 ]; then
echo "Usage: $0: (start|stop|restart)"
exit 1
fi
start_ldap() {
echo "Starting OpenLDAP."
echo "/usr/libexec/slapd"
/usr/libexec/slapd
sleep 1
}
stop_ldap() {
echo "Stopping OpenLDAP"
LDAPPID="$(pidof slapd|sed 's/ /\n/g'|sort -n|head -n1)"
if [ -z $LDAPPID ]; then
echo "slapd not running"
exit 1
else
echo "kill -INT $LDAPPID"
kill -INT $LDAPPID
sleep 1
fi
}
case $1 in
start ) start_ldap ;;
stop ) stop_ldap ;;
restart ) stop_ldap
start_ldap ;;
* ) echo "Usage: $0: (start|stop|restart)" ;;
esac
exit 0