Skip to content
Snippets Groups Projects
Commit e20c1b6c authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

shell fixes; output for couchdb2, ldap

parent b58c8778
Branches
No related tags found
1 merge request!54shell fixes; output for couchdb2, ldap
...@@ -15,8 +15,13 @@ typeset -i rc=0 ...@@ -15,8 +15,13 @@ typeset -i rc=0
# It stores the last exitcode in myrc # It stores the last exitcode in myrc
function fetchrc(){ function fetchrc(){
myrc=$? myrc=$?
echo rc=$myrc
rc=$rc+$myrc rc=$rc+$myrc
if [ $myrc -eq 0 ]; then
cecho ok "OK"
else
cecho error "FAILED (rc=$myrc)"
fi
} }
......
...@@ -89,12 +89,7 @@ ...@@ -89,12 +89,7 @@
if [ $myrc -eq 0 ]; then if [ $myrc -eq 0 ]; then
echo -n "gzip $1 ... " echo -n "gzip $1 ... "
gzip -9 -f "${1}" gzip -9 -f "${1}"
fetchrc >/dev/null fetchrc
if [ $myrc -eq 0 ]; then
cecho ok "OK"
else
cecho error "FAILED"
fi
else else
cecho error "ERROR occured while dumping - no gzip of $_outfile" cecho error "ERROR occured while dumping - no gzip of $_outfile"
fi fi
......
...@@ -223,7 +223,7 @@ function _doBackupOfSingleInstance(){ ...@@ -223,7 +223,7 @@ function _doBackupOfSingleInstance(){
fi fi
done done
rm -f "$dblist" rm -f "$dblist"
echo "__DB__$SERVICENAME INFO: ${COUCHDB_INSTANCE} - backed up $iDbCount dbs of $iDbTotal total" echo "__DB__$SERVICENAME backup INFO: ${COUCHDB_INSTANCE} - backed up $iDbCount dbs of $iDbTotal total"
} }
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
# ================================================================================ # ================================================================================
if [ -z $BACKUP_TARGETDIR ]; then if [ -z "$BACKUP_TARGETDIR" ]; then
echo ERROR: you cannot start `basename $0` directly echo ERROR: you cannot start $(basename $0) directly
rc=$rc+1 rc=$rc+1
exit 1 exit 1
fi fi
...@@ -53,14 +53,14 @@ function dump_ldap(){ ...@@ -53,14 +53,14 @@ function dump_ldap(){
DN=$1 DN=$1
DUMPFILE=$2 DUMPFILE=$2
slapcat -F $LDAP_CONF_DIR_PATH -b $DN -l $DUMPFILE echo -n "__DB__$SERVICENAME backup $LDAP_CONF_DIR_PATH .. DN $DN "
fetchrc slapcat -F $LDAP_CONF_DIR_PATH -b "$DN" -l "$DUMPFILE"
fetchrc >/dev/null
if [ $rc -ne 0 ]; then if [ $myrc -ne 0 ]; then
echo ERROR during backup $LDAP_CONF_DIR_PATH with DN $DN echo "ERROR during backup"
else else
echo Dump OK db._compressDumpfile "$DUMPFILE"
compress_file $DUMPFILE
fi fi
} }
...@@ -73,30 +73,30 @@ function doLdapBackup(){ ...@@ -73,30 +73,30 @@ function doLdapBackup(){
echo ----- LDAP BACKUP CONFIG echo ----- LDAP BACKUP CONFIG
# for cfgname in `ldapsearch -H ldap:// -x -s base -b "" -LLL "configContext" | grep "configContext" | cut -f 2 -d ":"` # for cfgname in `ldapsearch -H ldap:// -x -s base -b "" -LLL "configContext" | grep "configContext" | cut -f 2 -d ":"`
for cfgname in `ldapsearch -Y EXTERNAL -H ldapi:/// -s base -b '' -LLL configContext | grep "configContext" | cut -f 2 -d ":"` for cfgname in $(ldapsearch -Y EXTERNAL -H ldapi:/// -s base -b '' -LLL configContext | grep "configContext" | cut -f 2 -d ":")
do do
echo DN $cfgname echo DN $cfgname
cfg2=`echo $cfgname | sed "s#[\ =,]#_#g"` cfg2=$(echo $cfgname | sed "s#[\ =,]#_#g")
outfile=$(hostname)_ldap_olc_config__`get_outfile ${cfg2}`.ldif outfile=$(hostname)_ldap_olc_config__$(get_outfile ${cfg2}).ldif
dump_ldap $cfgname $BACKUP_TARGETDIR/$outfile dump_ldap "$cfgname" "$BACKUP_TARGETDIR/$outfile"
done done
echo ----- LDAP DATA echo ----- LDAP DATA
#for cfgname in `ldapsearch -H ldap:// -x -s base -b "" -LLL "namingContexts" | grep "namingContexts" | cut -f 2 -d ":"` #for cfgname in `ldapsearch -H ldap:// -x -s base -b "" -LLL "namingContexts" | grep "namingContexts" | cut -f 2 -d ":"`
for cfgname in `ldapsearch -Y EXTERNAL -H ldapi:/// -s base -b "" -LLL "namingContexts" | grep "namingContexts" | cut -f 2 -d ":"` for cfgname in $(ldapsearch -Y EXTERNAL -H ldapi:/// -s base -b "" -LLL "namingContexts" | grep "namingContexts" | cut -f 2 -d ":")
do do
echo DN $cfgname echo DN $cfgname
cfg2=`echo $cfgname | sed "s#[\ =,]#_#g"` cfg2=`echo $cfgname | sed "s#[\ =,]#_#g"`
outfile=$(hostname)_ldap_data__`get_outfile ${cfg2}`.ldif outfile=$(hostname)_ldap_data__$(get_outfile ${cfg2}).ldif
dump_ldap $cfgname $BACKUP_TARGETDIR/$outfile dump_ldap "$cfgname" "$BACKUP_TARGETDIR/$outfile"
done done
echo echo
echo ----- DUMPS echo ----- DUMPS
ls -l $BACKUP_TARGETDIR/*$BACKUP_DATE* ls -l "$BACKUP_TARGETDIR/*$BACKUP_DATE*"
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment