summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-nds/389-ds-base/files/restart-dirsrv')
-rw-r--r--net-nds/389-ds-base/files/restart-dirsrv30
1 files changed, 30 insertions, 0 deletions
diff --git a/net-nds/389-ds-base/files/restart-dirsrv b/net-nds/389-ds-base/files/restart-dirsrv
new file mode 100644
index 000000000000..90654eca170a
--- /dev/null
+++ b/net-nds/389-ds-base/files/restart-dirsrv
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# Script that restarts the ns-slapd server.
+# Exit status can be:
+# 0: Server restarted successfully
+# 1: Server could not be started
+# 2: Server started successfully (was not running)
+# 3: Server could not be stopped
+
+sleep_time=8
+/etc/init.d/389-ds status &> /dev/null
+running="${?}"
+
+rc-config stop 389-ds
+if [ "${?}" = "1" ]; then
+ sleep ${sleep_time}
+ exit 3
+fi
+rc-config start 389-ds
+if [ "${?}" = "1" ]; then
+ sleep ${sleep_time}
+ exit 1
+fi
+if [ "${running}" = "0" ]; then
+ sleep ${sleep_time}
+ exit 0
+else
+ sleep ${sleep_time}
+ exit 2
+fi