andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From 9f2221ef7656ae03bdb463b7ec6861738d197742 Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@redhat.com>
Date: Sun, 12 Apr 2015 16:44:40 -0700
Subject: [PATCH 312/319] Ticket #48148 - start/stop/restart-dirsrv utilities
 should ignore admin-serv directory

Description: {start,stop}-dirsrv script scans /etc/sysconfig/dirsrv-* to find
out the server instances to start/stop, which could include dirsrv-admin for
the Admin server if 389-admin is installed.

This patch silently skips "dirsrv-admin" from the server start/stop.

(cherry picked from commit 349db8decaff0d3a3b63aafc22c4b1714c4e9573)
---
 ldap/admin/src/scripts/start-dirsrv.in | 9 ++++++---
 ldap/admin/src/scripts/stop-dirsrv.in  | 9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/ldap/admin/src/scripts/start-dirsrv.in b/ldap/admin/src/scripts/start-dirsrv.in
index 291c821..0a38c4c 100755
--- a/ldap/admin/src/scripts/start-dirsrv.in
+++ b/ldap/admin/src/scripts/start-dirsrv.in
@@ -19,8 +19,12 @@ start_instance() {
     shift
 
     # source env. for this instance
-    if [ -f $initconfig_dir/@package_name@-$SERV_ID ] ; then
-        . $initconfig_dir/@package_name@-$SERV_ID
+    if [ $SERV_ID == "admin" ] ; then
+        # ignore admin
+        return 0 
+    elif [ -f $initconfig_dir/dirsrv-$SERV_ID ] ; then
+        echo Starting instance \"$SERV_ID\"
+        . $initconfig_dir/dirsrv-$SERV_ID
     else
         echo Instance $SERV_ID not found.
         return 1
@@ -127,7 +131,6 @@ if [ "$#" -eq 0 ]; then
     for i in $initconfig_dir/@package_name@-*; do
         regex=s,$initconfig_dir/@package_name@-,,g
         inst=`echo $i | sed -e $regex`
-        echo Starting instance \"$inst\"
         start_instance $inst
         if [ "$?" -ne 0 ]; then
             ret=$?
diff --git a/ldap/admin/src/scripts/stop-dirsrv.in b/ldap/admin/src/scripts/stop-dirsrv.in
index 4d88585..076af87 100755
--- a/ldap/admin/src/scripts/stop-dirsrv.in
+++ b/ldap/admin/src/scripts/stop-dirsrv.in
@@ -10,8 +10,12 @@ stop_instance() {
     SERV_ID=$1
 
     # source env. for this instance
-    if [ -f $initconfig_dir/@package_name@-$SERV_ID ] ; then
-        . $initconfig_dir/@package_name@-$SERV_ID
+    if [ $SERV_ID == "admin" ] ; then
+        # ignore admin
+        return 0 
+    elif [ -f $initconfig_dir/dirsrv-$SERV_ID ] ; then
+        echo Stopping instance \"$SERV_ID\"
+        . $initconfig_dir/dirsrv-$SERV_ID
     else
         echo Instance $SERV_ID not found.
         return 1
@@ -75,7 +79,6 @@ if [ "$#" -eq 0 ]; then
     for i in $initconfig_dir/@package_name@-*; do
         regex=s,$initconfig_dir/@package_name@-,,g
         inst=`echo $i | sed -e $regex`
-        echo Stopping instance \"$inst\"
         stop_instance $inst
         if [ "$?" -ne 0 ]; then
             ret=$?
-- 
1.9.3