diff options
| author | Noriko Hosoi <nhosoi@redhat.com> | 2006-10-27 16:45:18 +0000 |
|---|---|---|
| committer | Noriko Hosoi <nhosoi@redhat.com> | 2006-10-27 16:45:18 +0000 |
| commit | d7e0e0f62625c990e6d15d9da0bd9f2759979ef1 (patch) | |
| tree | 65c6cc88fd35ad9757b8b3cb287e79c21e2a6ccc /ldap/admin/src/scripts | |
| parent | fd813581526d7f446e0f105a1aafb91f23304676 (diff) | |
Resolves: #212098
Summary: Use autoconf to generate task perl script templates
Comment #10, #11, #14
Note: This is a generated file by autoconf. Checking this file in to support
the old style build. When migrating to the autotoolized build is completed,
this file is supposed to be removed from CVS.
Diffstat (limited to 'ldap/admin/src/scripts')
| -rw-r--r-- | ldap/admin/src/scripts/template-bak2db | 39 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/template-db2bak | 17 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/template-db2index | 21 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/template-db2ldif | 41 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/template-ldif2db | 20 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/template-ldif2ldap | 10 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/template-monitor | 13 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/template-restoreconfig | 17 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/template-saveconfig | 18 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/template-start-slapd | 77 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/template-stop-slapd | 48 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/template-suffix2instance | 16 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/template-vlvindex | 17 |
13 files changed, 354 insertions, 0 deletions
diff --git a/ldap/admin/src/scripts/template-bak2db b/ldap/admin/src/scripts/template-bak2db new file mode 100644 index 00000000..e8c0f4c5 --- /dev/null +++ b/ldap/admin/src/scripts/template-bak2db @@ -0,0 +1,39 @@ +#!/bin/sh + +prefix="{{DS-ROOT}}" +LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export LD_LIBRARY_PATH +SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export SHLIB_PATH + +if [ $# -lt 1 ] || [ $# -gt 3 ] +then + echo "Usage: bak2db archivedir [-n backendname]" + exit 1 +else + archivedir=$1 + shift +fi +while getopts "n:" flag +do + case $flag in + n) bename=$OPTARG;; + *) echo "Usage: bak2db archivedir [-n backendname]"; exit 2;; + esac +done + +if [ 1 = `expr $archivedir : "\/"` ] +then + archivedir=$archivedir +else + # relative + archivedir=`pwd`/$archivedir +fi + +cd {{SERVER-DIR}} +if [ "$#" -eq 2 ] +then + ./ns-slapd archive2db -D {{CONFIG-DIR}} -a $archivedir -n $bename +else + ./ns-slapd archive2db -D {{CONFIG-DIR}} -a $archivedir +fi diff --git a/ldap/admin/src/scripts/template-db2bak b/ldap/admin/src/scripts/template-db2bak new file mode 100644 index 00000000..1f7b08e4 --- /dev/null +++ b/ldap/admin/src/scripts/template-db2bak @@ -0,0 +1,17 @@ +#!/bin/sh + +prefix="{{DS-ROOT}}" +LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export LD_LIBRARY_PATH +SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export SHLIB_PATH + +cd {{SERVER-DIR}} +if [ "$#" -eq 1 ] +then + bak_dir=$1 +else + bak_dir={{BAK-DIR}}/`date +%Y_%m_%d_%H_%M_%S` +fi + +./ns-slapd db2archive -D {{CONFIG-DIR}} -a $bak_dir diff --git a/ldap/admin/src/scripts/template-db2index b/ldap/admin/src/scripts/template-db2index new file mode 100644 index 00000000..471416a3 --- /dev/null +++ b/ldap/admin/src/scripts/template-db2index @@ -0,0 +1,21 @@ +#!/bin/sh + +prefix="{{DS-ROOT}}" +LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export LD_LIBRARY_PATH +SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export SHLIB_PATH + +cd {{SERVER-DIR}} +if [ $# -eq 0 ] +then + bak_dir={{BAK-DIR}}/reindex_`date +%Y_%m_%d_%H_%M_%S` + ./ns-slapd upgradedb -D {{CONFIG-DIR}} -f -a "$bak_dir" +elif [ $# -lt 4 ] +then + echo "Usage: db2index [-n backend_instance | {-s includesuffix}* -t attribute[:indextypes[:matchingrules]] -T vlvattribute]" + exit 1 +else + ./ns-slapd db2index -D {{CONFIG-DIR}} "$@" +fi + diff --git a/ldap/admin/src/scripts/template-db2ldif b/ldap/admin/src/scripts/template-db2ldif new file mode 100644 index 00000000..8c02443a --- /dev/null +++ b/ldap/admin/src/scripts/template-db2ldif @@ -0,0 +1,41 @@ +#!/bin/sh + +prefix="{{DS-ROOT}}" +LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export LD_LIBRARY_PATH +SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export SHLIB_PATH + +cd {{SERVER-DIR}} +if [ "$#" -lt 2 ]; +then + echo "Usage: db2ldif {-n backend_instance}* | {-s includesuffix}*" + echo " [{-x excludesuffix}*] [-a outputfile]" + echo " [-N] [-r] [-C] [-u] [-U] [-m] [-M] [-1]" + echo "Note: either \"-n backend_instance\" or \"-s includesuffix\" is required." + exit 1 +fi + +set_ldif=0 +ldif_file="mydummy" +for arg in "$@" +do + if [ "$arg" = '-a' ]; + then + set_ldif=1 + elif [ $set_ldif -eq 1 ]; + then + ldif_file=$arg + set_ldif=2 + fi +done +if [ $ldif_file = "mydummy" ] +then + ldif_file={{LDIF-DIR}}/laputa-`date +%Y_%m_%d_%H%M%S`.ldif +fi +if [ $set_ldif -eq 2 ] +then +./ns-slapd db2ldif -D {{CONFIG-DIR}} "$@" +else +./ns-slapd db2ldif -D {{CONFIG-DIR}} -a $ldif_file "$@" +fi diff --git a/ldap/admin/src/scripts/template-ldif2db b/ldap/admin/src/scripts/template-ldif2db new file mode 100644 index 00000000..a5c59c4e --- /dev/null +++ b/ldap/admin/src/scripts/template-ldif2db @@ -0,0 +1,20 @@ +#!/bin/sh + +prefix="{{DS-ROOT}}" +LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export LD_LIBRARY_PATH +SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export SHLIB_PATH + +cd {{SERVER-DIR}} +if [ $# -lt 4 ] +then + echo "Usage: ldif2db -n backend_instance | {-s includesuffix}* [{-x excludesuffix}*]" + echo " {-i ldiffile}* [-O]" + echo "Note: either \"-n backend_instance\" or \"-s includesuffix\" and \"-i ldiffile\" are required." + exit 1 +fi + +echo importing data ... +./ns-slapd ldif2db -D {{CONFIG-DIR}} "$@" 2>&1 +exit $? diff --git a/ldap/admin/src/scripts/template-ldif2ldap b/ldap/admin/src/scripts/template-ldif2ldap new file mode 100644 index 00000000..6519cbfb --- /dev/null +++ b/ldap/admin/src/scripts/template-ldif2ldap @@ -0,0 +1,10 @@ +#!/bin/sh + +prefix="{{DS-ROOT}}" +PATH=$prefix/usr/lib/mozldap6:/usr/lib/mozldap6 +LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:/usr/lib/dirsec:$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export LD_LIBRARY_PATH +SHLIB_PATH=$prefix/usr/lib/dirsec:/usr/lib/dirsec:$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export SHLIB_PATH + +ldapmodify -a -p {{SERVER-PORT}} -D "$1" -w "$2" -f $3 diff --git a/ldap/admin/src/scripts/template-monitor b/ldap/admin/src/scripts/template-monitor new file mode 100644 index 00000000..8df67e5f --- /dev/null +++ b/ldap/admin/src/scripts/template-monitor @@ -0,0 +1,13 @@ +#!/bin/sh + +PATH=$prefix/usr/lib/mozldap6:/usr/lib/mozldap6 +LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:/usr/lib/dirsec:$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export LD_LIBRARY_PATH +SHLIB_PATH=$prefix/usr/lib/dirsec:/usr/lib/dirsec:$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export SHLIB_PATH + +if [ "x$1" != "x" ]; +then MDN="$1"; +else MDN="cn=monitor"; + fi +ldapsearch -p {{SERVER-PORT}} -b "$MDN" -s base "objectClass=*" diff --git a/ldap/admin/src/scripts/template-restoreconfig b/ldap/admin/src/scripts/template-restoreconfig new file mode 100644 index 00000000..bfc0f3aa --- /dev/null +++ b/ldap/admin/src/scripts/template-restoreconfig @@ -0,0 +1,17 @@ +#!/bin/sh + +prefix="{{DS-ROOT}}" +LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export LD_LIBRARY_PATH +SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export SHLIB_PATH + +cd {{SERVER-DIR}} +conf_ldif=`ls -1t {{BAK-DIR}}/{{SERV-ID}}-*.ldif | head -1` +if [ -z "$conf_ldif" ] +then + echo No configuration to restore in {{BAK-DIR}} ; exit 1 +fi +echo Restoring $conf_ldif +./ns-slapd ldif2db -D {{CONFIG-DIR}} -i $conf_ldif -n NetscapeRoot 2>&1 +exit $? diff --git a/ldap/admin/src/scripts/template-saveconfig b/ldap/admin/src/scripts/template-saveconfig new file mode 100644 index 00000000..3f62a33e --- /dev/null +++ b/ldap/admin/src/scripts/template-saveconfig @@ -0,0 +1,18 @@ +#!/bin/sh + +prefix="{{DS-ROOT}}" +LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export LD_LIBRARY_PATH +SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export SHLIB_PATH + +cd {{SERVER-DIR}} +echo saving configuration ... +conf_ldif={{BAK-DIR}}/{{SERV-ID}}-`date +%Y_%m_%d_%H%M%S`.ldif +./ns-slapd db2ldif -N -D {{CONFIG-DIR}} -s "o=NetscapeRoot" -a $conf_ldif -n NetscapeRoot 2>&1 +if [ "$?" -ge 1 ] +then + echo Error occurred while saving configuration + exit 1 +fi +exit 0 diff --git a/ldap/admin/src/scripts/template-start-slapd b/ldap/admin/src/scripts/template-start-slapd new file mode 100644 index 00000000..33bcbb30 --- /dev/null +++ b/ldap/admin/src/scripts/template-start-slapd @@ -0,0 +1,77 @@ +#!/bin/sh + +prefix="{{DS-ROOT}}" +LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export LD_LIBRARY_PATH +SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export SHLIB_PATH + +# Script that starts the ns-slapd server. +# Exit status can be: +# 0: Server started successfully +# 1: Server could not be started +# 2: Server already running + +NETSITE_ROOT={{SERVER-DIR}} +export NETSITE_ROOT +DS_CONFIG_DIR={{CONFIG-DIR}} +export DS_CONFIG_DIR +PIDFILE={{RUN-DIR}}/pid +STARTPIDFILE={{RUN-DIR}}/startpid +if test -f $STARTPIDFILE ; then + PID=`cat $STARTPIDFILE` + if kill -0 $PID > /dev/null 2>&1 ; then + echo There is an ns-slapd process already running: $PID + exit 2; + else + rm -f $STARTPIDFILE + fi +fi +if test -f $PIDFILE ; then + PID=`cat $PIDFILE` + if kill -0 $PID > /dev/null 2>&1 ; then + echo There is an ns-slapd running: $PID + exit 2; + else + rm -f $PIDFILE + fi +fi +cd {{SERVER-DIR}}; ./ns-slapd -D {{CONFIG-DIR}} -i $PIDFILE -w $STARTPIDFILE "$@" +if [ $? -ne 0 ]; then + exit 1 +fi + +loop_counter=1 +# wait for 10 seconds for the start pid file to appear +max_count=10 +while test $loop_counter -le $max_count; do + loop_counter=`expr $loop_counter + 1` + if test ! -f $STARTPIDFILE ; then + sleep 1; + else + PID=`cat $STARTPIDFILE` + fi +done +if test ! -f $STARTPIDFILE ; then + echo Server failed to start !!! Please check errors log for problems + exit 1 +fi +loop_counter=1 +# wait for 10 minutes (600 times 1 seconds) +max_count=600 +while test $loop_counter -le $max_count; do + loop_counter=`expr $loop_counter + 1` + if test ! -f $PIDFILE ; then + if kill -0 $PID > /dev/null 2>&1 ; then + sleep 1 + else + echo Server failed to start !!! Please check errors log for problems + exit 1 + fi + else + PID=`cat $PIDFILE` + exit 0; + fi +done +echo Server not running!! Failed to start ns-slapd process. Please check the errors log for problems. +exit 1 diff --git a/ldap/admin/src/scripts/template-stop-slapd b/ldap/admin/src/scripts/template-stop-slapd new file mode 100644 index 00000000..db51382c --- /dev/null +++ b/ldap/admin/src/scripts/template-stop-slapd @@ -0,0 +1,48 @@ +#!/bin/sh + +prefix="{{DS-ROOT}}" +LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export LD_LIBRARY_PATH +SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export SHLIB_PATH + +# Script that stops the ns-slapd server. +# Exit status can be: +# 0: Server stopped successfully +# 1: Server could not be stopped +# 2: Server was not running + +PIDFILE={{RUN-DIR}}/pid +if test ! -f $PIDFILE ; then + echo No ns-slapd PID file found. Server is probably not running + exit 2 +fi +PID=`cat $PIDFILE` +# see if the server is already stopped +kill -0 $PID > /dev/null 2>&1 || { + echo Server not running + if test -f $PIDFILE ; then + rm -f $PIDFILE + fi + exit 2 +} +# server is running - kill it +kill $PID +loop_counter=1 +# wait for 10 minutes (600 times 1 second) +max_count=600 +while test $loop_counter -le $max_count; do + loop_counter=`expr $loop_counter + 1` + if kill -0 $PID > /dev/null 2>&1 ; then + sleep 1; + else + if test -f $PIDFILE ; then + rm -f $PIDFILE + fi + exit 0 + fi +done +if test -f $PIDFILE ; then + echo Server still running!! Failed to stop the ns-slapd process: $PID. Please check the errors log for problems. +fi +exit 1 diff --git a/ldap/admin/src/scripts/template-suffix2instance b/ldap/admin/src/scripts/template-suffix2instance new file mode 100644 index 00000000..f3642468 --- /dev/null +++ b/ldap/admin/src/scripts/template-suffix2instance @@ -0,0 +1,16 @@ +#!/bin/sh + +prefix="{{DS-ROOT}}" +LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export LD_LIBRARY_PATH +SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export SHLIB_PATH + +cd {{SERVER-DIR}} +if [ $# -lt 2 ] +then + echo Usage: suffix2instance {-s includesuffix}* + exit 1 +fi + +./ns-slapd suffix2instance -D {{CONFIG-DIR}} "$@" 2>&1 diff --git a/ldap/admin/src/scripts/template-vlvindex b/ldap/admin/src/scripts/template-vlvindex new file mode 100644 index 00000000..6d507fb4 --- /dev/null +++ b/ldap/admin/src/scripts/template-vlvindex @@ -0,0 +1,17 @@ +#!/bin/sh + +prefix="{{DS-ROOT}}" +LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export LD_LIBRARY_PATH +SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec +export SHLIB_PATH + +cd {{SERVER-DIR}} +if [ $# -lt 4 ] +then + echo "Usage: vlvindex -n backend_instance | {-s includesuffix}* -T attribute" + echo Note: either \"-n backend_instance\" or \"-s includesuffix\" are required. + exit 1 +fi + +./ns-slapd db2index -D {{CONFIG-DIR}} "$@" |
