aboutsummaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-support/openldap/files/initscript
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openstack/recipes-support/openldap/files/initscript')
-rw-r--r--meta-openstack/recipes-support/openldap/files/initscript62
1 files changed, 62 insertions, 0 deletions
diff --git a/meta-openstack/recipes-support/openldap/files/initscript b/meta-openstack/recipes-support/openldap/files/initscript
new file mode 100644
index 00000000..f9c343a3
--- /dev/null
+++ b/meta-openstack/recipes-support/openldap/files/initscript
@@ -0,0 +1,62 @@
+#! /bin/sh
+#
+# This is an init script for openembedded
+# Copy it to /etc/init.d/openldap and type
+# > update-rc.d openldap defaults 60
+#
+
+
+slapd=/usr/libexec/slapd
+test -x "$slapd" || exit 0
+
+src_data_dir=/etc/openldap/
+data_dir=%LDAP_DATADIR%
+pidfile=%LDAP_DATADIR%/slapd.pid
+
+start()
+{
+ need_init=0
+ if [ ! -e $data_dir/DB_CONFIG ]; then
+ cp $src_data_dir/DB_CONFIG.example $data_dir/DB_CONFIG
+ need_init=1
+ fi
+ echo -n "Starting OpenLDAP: "
+ start-stop-daemon --start --quiet --exec $slapd
+ echo "."
+
+ if [ $need_init -eq 1 ]; then
+ sleep 1
+ ldapadd -x -D "cn=Manager,%DEFAULT_DN%" -w secret -f /etc/openldap/ops-base.ldif -c
+ fi
+}
+
+stop()
+{
+ echo -n "Stopping OpenLDAP: "
+ start-stop-daemon --stop --quiet --pidfile $pidfile
+ echo "."
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ reset)
+ stop
+ sleep 1
+ rm $data_dir/*
+ start
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ *)
+ echo "Usage: /etc/init.d/openldap {start|stop|reset|restart|reset}"
+ exit 1
+esac
+
+exit 0