[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  #!/bin/bash
   2  #
   3  # SambaEdu
   4  #
   5  # $Id: se3_infos_machine.sh 6239 2011-03-16 07:39:37Z ericg $
   6  #
   7  
   8  WWWPATH="/var/www"
   9  
  10  # recup parametres ldap
  11  . /etc/se3/config_l.cache.sh
  12  # recup parametres caches : 
  13  . /etc/se3/config_m.cache.sh
  14  . /etc/se3/config_d.cache.sh
  15  
  16  if [ "$1" = "-h" -o "$1" = "--help" ]; then
  17      echo "Script destine a retourner la liste des infos concernant une machine."
  18      echo ""
  19      echo "USAGE: Passer en parametre le nom d'une machine."
  20      echo ""
  21      exit
  22  fi
  23  
  24  interactif="y"
  25  
  26  machine=""
  27  if [ -n "$1" ]; then
  28      t=$(ldapsearch -xLLL cn=$1 -b $computersRdn},$ldap_base_dn})
  29      if [ -z "$t" ]; then
  30          echo "Machine $1 invalide"
  31      else
  32          machine=$1
  33          interactif="n"
  34      fi
  35  fi
  36  
  37  while [ -z "$machine" ]
  38  do
  39      # Choix d'une machine
  40      echo ""
  41      echo "Voici la liste des machines existantes: "
  42      ldapsearch -xLLL -b $computersRdn},$ldap_base_dn} cn|grep "^cn: "| sed -e "s|^cn:||" | sort | uniq | tr -d '\n' | more
  43  
  44      echo ""
  45      echo -e "Choix d'une machine: \c"
  46      read -e machine
  47  
  48      if [ -n "$machine" ]; then
  49          t=$(ldapsearch -xLLL cn=$machine -b $computersRdn},$ldap_base_dn})
  50          if [ -z "$t" ]; then
  51              echo "Machine $machine invalide"
  52              machine=""
  53          fi
  54      fi
  55  done
  56  
  57  ipHostNumber=$(ldapsearch -xLLL cn=$machine -b $computersRdn},$ldap_base_dn} ipHostNumber | grep "^ipHostNumber: " |sed -e "s|ipHostNumber: ||")
  58  macAddress=$(ldapsearch -xLLL cn=$machine -b $computersRdn},$ldap_base_dn} macAddress | grep "^macAddress: " |sed -e "s|macAddress: ||")
  59  echo "machine =      $machine"
  60  echo "ipHostNumber = $ipHostNumber"
  61  echo "macAddress =   $macAddress"


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