andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 41e0e84398114f6d86e91e1e3354bf4f2d5667c4 Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Thu, 7 May 2015 15:42:18 -0700
dc8c34
Subject: [PATCH 323/323] Ticket #48148 - start/stop/restart-dirsrv utilities
dc8c34
 should ignore admin-serv directory
dc8c34
dc8c34
Description:
dc8c34
1) The script restart-dirsrv also needed to skip /etc/sysconfig/dirsrv-admin.
dc8c34
   This patch silently skips "dirsrv-admin" for restarting dirsrv, as well.
dc8c34
dc8c34
2) If the non-root user runs start/stop/restart-dirsrv, it checks ~/.dirsrv
dc8c34
   to look for the dirsrv-* file.  If the directory is empty, it accidentally
dc8c34
   picks up a file name from the current directory, which is not right.
dc8c34
dc8c34
   This patch checks the /etc/sysconfig or ~/.dirsrv directory whether the
dc8c34
   dirsrv-* file exists or not.  If it does not, the scripts just exit with
dc8c34
   SUCCESS (== 0).
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/48148
dc8c34
dc8c34
Reviewed and commentted by rmeggins@redhat.com (Thank you, Rich!!)
dc8c34
dc8c34
(cherry picked from commit 070037a3f9ac880c5c38e38419ad23bf4209eb47)
dc8c34
---
dc8c34
 ldap/admin/src/scripts/restart-dirsrv.in | 15 +++++++++++----
dc8c34
 ldap/admin/src/scripts/start-dirsrv.in   |  1 +
dc8c34
 ldap/admin/src/scripts/stop-dirsrv.in    |  1 +
dc8c34
 3 files changed, 13 insertions(+), 4 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/admin/src/scripts/restart-dirsrv.in b/ldap/admin/src/scripts/restart-dirsrv.in
dc8c34
index 76fb176..79fc1b1 100644
dc8c34
--- a/ldap/admin/src/scripts/restart-dirsrv.in
dc8c34
+++ b/ldap/admin/src/scripts/restart-dirsrv.in
dc8c34
@@ -10,6 +10,10 @@
dc8c34
 restart_instance() {
dc8c34
     SERV_ID=$1
dc8c34
 
dc8c34
+    if [ $SERV_ID == "admin" ]; then
dc8c34
+        #ignore admin
dc8c34
+        return 0
dc8c34
+    fi
dc8c34
     server_already_stopped=0
dc8c34
     @sbindir@/stop-dirsrv -d $initconfig_dir $SERV_ID
dc8c34
     status=$?
dc8c34
@@ -48,12 +52,15 @@ if [ "$#" -eq 0 ]; then
dc8c34
     # We're restarting all instances.
dc8c34
     ret=0
dc8c34
     for i in $initconfig_dir/@package_name@-*; do
dc8c34
+        if [ ! -f "$i" ] ; then break ; fi
dc8c34
         regex=s,$initconfig_dir/@package_name@-,,g
dc8c34
         inst=`echo $i | sed -e $regex`
dc8c34
-        echo Restarting instance \"$inst\"
dc8c34
-        restart_instance $inst
dc8c34
-        if [ "$?" -ne 0 ]; then
dc8c34
-            ret=$?
dc8c34
+        if [ $inst != "admin" ]; then
dc8c34
+            echo Restarting instance \"$inst\"
dc8c34
+            restart_instance $inst
dc8c34
+            if [ "$?" -ne 0 ]; then
dc8c34
+                ret=$?
dc8c34
+            fi
dc8c34
         fi
dc8c34
     done
dc8c34
     exit $ret
dc8c34
diff --git a/ldap/admin/src/scripts/start-dirsrv.in b/ldap/admin/src/scripts/start-dirsrv.in
dc8c34
index 0a38c4c..4e36939 100755
dc8c34
--- a/ldap/admin/src/scripts/start-dirsrv.in
dc8c34
+++ b/ldap/admin/src/scripts/start-dirsrv.in
dc8c34
@@ -129,6 +129,7 @@ if [ "$#" -eq 0 ]; then
dc8c34
     # We're starting all instances.
dc8c34
     ret=0
dc8c34
     for i in $initconfig_dir/@package_name@-*; do
dc8c34
+        if [ ! -f "$i" ] ; then break ; fi
dc8c34
         regex=s,$initconfig_dir/@package_name@-,,g
dc8c34
         inst=`echo $i | sed -e $regex`
dc8c34
         start_instance $inst
dc8c34
diff --git a/ldap/admin/src/scripts/stop-dirsrv.in b/ldap/admin/src/scripts/stop-dirsrv.in
dc8c34
index 076af87..15a84a4 100755
dc8c34
--- a/ldap/admin/src/scripts/stop-dirsrv.in
dc8c34
+++ b/ldap/admin/src/scripts/stop-dirsrv.in
dc8c34
@@ -77,6 +77,7 @@ if [ "$#" -eq 0 ]; then
dc8c34
     # We're stopping all instances.
dc8c34
     ret=0
dc8c34
     for i in $initconfig_dir/@package_name@-*; do
dc8c34
+        if [ ! -f "$i" ] ; then break ; fi
dc8c34
         regex=s,$initconfig_dir/@package_name@-,,g
dc8c34
         inst=`echo $i | sed -e $regex`
dc8c34
         stop_instance $inst
dc8c34
-- 
dc8c34
1.9.3
dc8c34