[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3master/usr/share/se3/sbin/ -> se3_modif_attribut_ldap.sh (source)

   1  #!/bin/bash
   2  #
   3  ## $Id: se3_modif_attribut_ldap.sh 7745 2013-03-31 23:53:39Z keyser $ ##
   4  #
   5  ##### Script de modification d'attributs LDAP - stéphane Boireau #####
   6  
   7  if [ -z "$3" -o "$1" = "-h" -o "$1" = "--help" ]; then
   8      echo "Script de modification d'attributs LDAP"
   9      echo ""
  10      echo "USAGE: $0 entree_a_modifier=valeur ou=branche attribut=valeur"
  11      echo "       Exemple: $0 uid=toto ou=People sn=Tot"
  12      echo "                changera l'attribut sn de uid=toto dans la branche People."
  13      exit
  14  fi
  15  
  16  . /etc/se3/config_l.cache.sh
  17  
  18  dest_svg=/var/se3/save/svg_modif_ldap
  19  mkdir -p $dest_svg}
  20  ladate=$(date "+%Y%m%d_%H%M%S")
  21  
  22  motif=$1
  23  motif_modif=$(echo "$motif}" | tr "=" "_")
  24  
  25  branche=$2
  26  
  27  attribut=$(echo "$3"|cut -d"=" -f1)
  28  valeur=$(echo "$3"|cut -d"=" -f2)
  29  
  30  ldapsearch -xLLL -D $adminRdn},$ldap_base_dn} -w $adminPw} $motif} > $dest_svg}/$motif_modif}_$ladate}.ldif
  31  if [ "$?" != "0" ]; then
  32      echo "Abandon: La sauvegarde a echoue."
  33      exit
  34  fi
  35  
  36  echo "dn: $motif},$branche},$ldap_base_dn}
  37  changetype: modify
  38  replace: $attribut}
  39  $attribut}: $valeur}
  40  " > $dest_svg}/modif_$motif_modif}_$ladate}.ldif
  41  
  42  ldapmodify -x -D $adminRdn},$ldap_base_dn} -w $adminPw} -f $dest_svg}/modif_$motif_modif}_$ladate}.ldif
  43  if [ "$?" != "0" ]; then
  44      echo "Echec"
  45      exit 1
  46  else
  47      echo "Succes"
  48      exit 0
  49  fi


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1