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.
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.
Created attachment 115370 [details] proposed /etc/sysconfig/ns-slapd file.
*** Bug 159361 has been marked as a duplicate of this bug. ***
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.
Created attachment 147814 [details] diffs Add the new initscript. The initscript is called $PACKAGE_NAME which by default is fedora-ds. This script is created from wrappers/initscript.in, sed'd by the fixupcmd in Makefile.am 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 /etc/fedora-ds/slapd-foo /etc/fedora-ds/slapd-bar 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 configure.ac. 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 configure.ac, 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.
Created attachment 147815 [details] proposed new initscript.in
The changes look good. The init scripts are stored in /sbin/init.d on HP-UX.
Created attachment 147821 [details] cvs commit log
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/initscript.in 12 Feb 2007 19:39:09 -0000 1.2 +++ ldapserver/wrappers/initscript.in 12 Feb 2007 20:10:21 -0000 1.3 @@ -39,24 +39,24 @@ umask 077 pids=$(pidof $exec) INSTANCES="" 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" fi done if [ -n "$2" ]; then for I in $INSTANCES; do - if [ "$2" == "$I" ]; then + if [ "$2" = "$I" ]; then INSTANCES="$2" fi done if [ "$2" != "$INSTANCES" ]; then echo -n "$2 is an invalid @package_name@ instance" failure; echo exit 1 fi Checking in initscript.in; /cvs/dirsec/ldapserver/wrappers/initscript.in,v <-- initscript.in new revision: 1.3; previous revision: 1.2 done
Verification test: PASS Test machine: cypher.dsdev.sjc.redhat.com (RHEL 5 64bit) Test steps: 1. install DS on cypher.dsdev.sjc.redhat.com 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...