From 2a4d5156c916fe309a8651982dd604f4e518a38f Mon Sep 17 00:00:00 2001 From: Marisa Date: Sun, 26 Oct 2025 14:49:26 -0400 Subject: [PATCH] Add start-slapd.sh --- start-slapd.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 start-slapd.sh diff --git a/start-slapd.sh b/start-slapd.sh new file mode 100644 index 0000000..921d603 --- /dev/null +++ b/start-slapd.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# --- 1. Start slapd in the background (This is the critical part you asked about) --- +echo "Starting slapd service..." + +# The user's desired slapd command, running in the background (&) +/usr/sbin/slapd -h "ldap:/// ldapi:///" -g openldap -u openldap -F /etc/ldap/slapd.d & + +# Wait briefly for the service to start +sleep 3 + +# Check if slapd started successfully +SLAPD_PID=$! +if kill -0 $SLAPD_PID 2>/dev/null; then + echo "OpenLDAP slapd service started successfully with PID: $SLAPD_PID" +else + echo "OpenLDAP slapd already running with PID: $SLAPD_PID" +fi + +# --- 2. Execute the command passed to the container --- +# 'exec' replaces the script process with the command (e.g., /bin/bash), +# ensuring the container stays alive as long as that command runs interactively. +echo "Executing: $@" +exec "$@" \ No newline at end of file