Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 160235 - Add support for /etc/init scripts
Summary: Add support for /etc/init scripts
Alias: None
Product: 389
Classification: Retired
Component: Admin
Version: 7.1
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Rich Megginson
QA Contact: Viktor Ashirov
: 159361 (view as bug list)
Depends On:
Blocks: 159361 FDS1.1.0
TreeView+ depends on / blocked
Reported: 2005-06-13 18:46 UTC by Rich Megginson
Modified: 2015-12-07 16:57 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2015-12-07 16:57:03 UTC

Attachments (Terms of Use)
proposed /etc/init.d/ns-slapd file (deleted)
2005-06-13 18:54 UTC, Brian Jones
no flags Details
proposed /etc/sysconfig/ns-slapd file. (deleted)
2005-06-13 18:55 UTC, Brian Jones
no flags Details
diffs (deleted)
2007-02-09 21:35 UTC, Rich Megginson
no flags Details | Diff
proposed new (deleted)
2007-02-09 21:36 UTC, Rich Megginson
no flags Details
cvs commit log (deleted)
2007-02-09 22:34 UTC, Rich Megginson
no flags Details

Description Rich Megginson 2005-06-13 18:46:54 UTC
These scripts are used with the init process to start up the server at boot time
and also to use the system management scripts to manage the slapd process.

Comment 1 Brian Jones 2005-06-13 18:54:19 UTC
Created attachment 115369 [details]
proposed /etc/init.d/ns-slapd file

This is a fairly standard sysv init script for ns-slapd. Someone wiser than I
can probably clean it up further.

Comment 2 Brian Jones 2005-06-13 18:55:41 UTC
Created attachment 115370 [details]
proposed /etc/sysconfig/ns-slapd file.

Comment 3 Sean Cotter 2005-07-23 00:07:51 UTC
*** Bug 159361 has been marked as a duplicate of this bug. ***

Comment 5 Rich Megginson 2007-01-10 16:43:27 UTC
If we are not going to support full SELinux policy, we need to use runcon to
allow the server to run unconfined while still allowing the rest of the OS to
run with SELinux enforcing:

runcon -t unconfined_t -- ns-slapd .... args ....
See bug 174855 and bug 172467

Also, if we are still going to support the start-admin and start-slapd scripts,
they too will need to use runcon.

Comment 6 Rich Megginson 2007-02-09 21:35:28 UTC
Created attachment 147814 [details]

Add the new initscript.  The initscript is called $PACKAGE_NAME which by
default is fedora-ds.  This script is created from wrappers/,
sed'd by the fixupcmd in during make install.  The way it works is
this: service fedora-ds cmd will execute the cmd on all instances (found in
/etc/fedora-ds by default).  service fedora-ds cmd instance will execute cmd on
only that instance.  So if you have
and you do
service start fedora-ds
it will start up both slapd-foo and slapd-bar.	If you do
service start fedora-ds bar
it will start up only slapd-bar.  If you do
service start fedora-ds biff
you will get an error message.	The initdir is platform specific (e.g.
/etc/rc.d/init.d on linux, /etc/init.d on Solaris, ?? on hpux) so the
definition was added to the platform dependent section of

The init script is explicitly branded, including the filename.	I needed to add
support to the autotool files so that we could change the name of the file. 
Since package_name is defined when you use the AC_INIT macro in,
we don't need to define it elsewhere (e.g. #define BRAND_DS).  So I added the
branding and other information to the autotool files, and changed
create_instance to use package_name instead of brand_ds to be consistent. 
Having the package_name defined in much fewer places should make it much easier
to change in the future if necessary.

I also fixed a compiler warning in ldaprot.h.

Comment 7 Rich Megginson 2007-02-09 21:36:03 UTC
Created attachment 147815 [details]
proposed new

Comment 8 Nathan Kinder 2007-02-09 22:13:28 UTC
The changes look good.  The init scripts are stored in /sbin/init.d on HP-UX.

Comment 9 Rich Megginson 2007-02-09 22:34:54 UTC
Created attachment 147821 [details]
cvs commit log

Comment 10 Rich Megginson 2007-02-12 20:12:13 UTC
I had to remove some bash-isms that were causing the initscript to fail on RHEL-4.

diff -u -8 -r1.2 -r1.3
--- ldapserver/wrappers/   12 Feb 2007 19:39:09 -0000      1.2
+++ ldapserver/wrappers/   12 Feb 2007 20:10:21 -0000      1.3
@@ -39,24 +39,24 @@
 umask 077

 pids=$(pidof $exec)


 for FILE in `/bin/ls -d $instbase/slapd-* 2>/dev/null`; do
     if [ -d "$FILE" ] ; then
-        INSTANCES+=$(echo "$FILE" | sed -e "s|$instbase/slapd-||")
-        INSTANCES+=" "
+        inst=$(echo "$FILE" | sed -e "s|$instbase/slapd-||")
+        INSTANCES="$INSTANCES $inst"

 if [ -n "$2" ]; then
    for I in $INSTANCES; do
-      if [ "$2" == "$I" ]; then
+      if [ "$2" = "$I" ]; then
    if [ "$2" != "$INSTANCES" ]; then
       echo -n "$2 is an invalid @package_name@ instance"
       failure; echo
       exit 1

Checking in;
/cvs/dirsec/ldapserver/wrappers/,v  <--
new revision: 1.3; previous revision: 1.2

Comment 11 Yi Zhang 2007-12-03 23:32:24 UTC
Verification test: PASS
Test machine: (RHEL 5 64bit)

Test steps:

1. install DS on
2. do the following and verify desired result:
[root@neo ~]# /etc/init.d/dirsrv stop
Shutting down dirsrv: 
    neo...                                                 [  OK  ]
[root@neo ~]# /etc/init.d/dirsrv start
Starting dirsrv: 
    neo...                                                 [  OK  ]
[root@neo ~]# /etc/init.d/dirsrv status
dirsrv neo (pid 22019) is running...

Note You need to log in before you can comment on or make changes to this bug.