LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-19-2007, 08:26 AM   #1
lchxr
Member
 
Registered: Mar 2006
Posts: 42

Rep: Reputation: 15
Openldap blocks other services


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

Last edited by lchxr; 11-19-2007 at 08:31 AM.
 
Old 11-19-2007, 08:38 AM   #2
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
See that "exit 0" at the end of the openldap startup script? There's your problem.
There's no need to reorder rc.M - the fix is easy (and no, it's not to remove the "exit 0" from rc.openldap).

Instead of sourcing the rc.openldap script in rc.M like this:
Code:
. /etc/rc.d/rc.openldap start
Just execute it like this:
Code:
/etc/rc.d/rc.openldap start
When a script is sourced, it basically includes the sourced script into the sourcing script, just as if the content of the sourced script were *actually* inside the sourcing script. Therefore, when the "exit 0" is encountered, rc.M does exactly what it's supposed to do - it exits.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to block access certain services shankarLe Linux - Security 3 07-27-2007 03:35 AM
OpenLdap/Linux Directory Services (thoughts more then tech info) amfony Linux - General 2 07-27-2006 07:13 AM
OPENLDAP to centralise services simquest Linux - Networking 1 04-11-2006 05:32 PM
iptables to block lan services (audit mine) michaelsanford Linux - Networking 3 04-26-2005 09:25 AM
Level & Checks block Services (Telnet, VNC...) kt8993 Mandriva 2 10-03-2004 09:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration