script that checks if the LDIF files are in sync with the ldap server
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 17 Dec 2007 03:45:57 +0000 (03:45 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 17 Dec 2007 03:45:57 +0000 (03:45 +0000)
SHUTTLE/schema_prod/verify.sh [new file with mode: 0755]

diff --git a/SHUTTLE/schema_prod/verify.sh b/SHUTTLE/schema_prod/verify.sh
new file mode 100755 (executable)
index 0000000..4d3a968
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+if [ -z "$1" ]
+then
+    echo "Verifies if the LDAP entry corresponds to the entry in the file."
+    echo "Usage: verify.sh <3 DIGIT DET CODE>"
+    echo "       verify.sh sys-[HLT|DCS|DAQ]"
+    echo "       verify.sh global"
+    echo "       verify.sh ALL"
+    exit
+fi
+
+case "$1" in
+    "global"  ) SEARCH="name=globalConfig"; FILE="Global.ldif";;
+    "sys-HLT" ) SEARCH="system=HLT"; FILE="HLTsys.ldif";;
+    "sys-DAQ" ) SEARCH="system=DAQ"; FILE="DAQsys.ldif";;
+    "sys-DCS" ) SEARCH="system=DCS"; FILE="DCSsys.ldif";;
+    "ALL"     ) LIST="EMC FMD HMP MCH MTR PHS PMD SPD SDD SSD TOF TPC TRD T00 V00 ZDC GRP ACO HLT global sys-HLT sys-DCS sys-DAQ"
+                for I in $LIST
+               do 
+                 echo "Checking $I"
+                 ./verify.sh $I
+               done
+               exit
+               ;;
+    *         ) SEARCH="det=$1"; FILE="$1.ldif";;
+esac
+
+ldapsearch -H ldap://pcalishuttle01.cern.ch  -x -b "$SEARCH,o=shuttle_prod,dc=cern,dc=ch" -L -L -L > verify.out
+
+diff --ignore-space-change --ignore-blank-lines verify.out $FILE | grep -v "> #"
+