[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  #!/bin/bash
   2  
   3  [[ "$#" != "2" ]] && exit 1
   4  
   5  if [ -e /var/www/se3/includes/config.inc.php ]; then
   6          dbhost=`cat /var/www/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f 2 |cut -d \" -f 2`
   7          dbname=`cat /var/www/se3/includes/config.inc.php | grep "dbname=" | cut -d = -f 2 |cut -d \" -f 2`
   8          dbuser=`cat /var/www/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 |cut -d \" -f 2`
   9          dbpass=`cat /var/www/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 |cut -d \" -f 2`
  10  else
  11          echo "Fichier de conf inaccessible" >> $SE3LOG
  12          exit 1
  13  fi
  14  
  15  #
  16  # Recuperation des params LDAP
  17  #
  18  
  19  BASEDN=`echo "SELECT value FROM params WHERE name='ldap_base_dn'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N`
  20  if [ -z "$BASEDN" ]; then
  21          echo "Impossible d'accéder au paramètre BASEDN"
  22          exit 1
  23  fi
  24  PARCSRDN=`echo "SELECT value FROM params WHERE name='parcsRdn'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N`
  25  if [ -z "$PARCSRDN" ]; then
  26          echo "Impossible d'accéder au paramètre PARCSRDN"
  27          exit 1
  28  fi
  29  PRINTERSRDN=`echo "SELECT value FROM params WHERE name='printersRdn'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N`
  30  if [ -z "$PRINTERSRDN" ]; then
  31          echo "Impossible d'accéder au paramètre PRINTERSRDN"
  32          exit 1
  33  fi
  34  ADMINRDN=`echo "SELECT value FROM params WHERE name='adminRdn'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N`
  35  if [ -z "$ADMINRDN" ]; then
  36          echo "Impossible d'accéder au paramètre ADMINRDN"
  37          exit 1
  38  fi
  39  ADMINPW=`echo "SELECT value FROM params WHERE name='adminPw'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N`
  40  if [ -z "$ADMINPW" ]; then
  41          echo "Impossible d'accéder au paramètre ADMINPW"
  42          exit 1
  43  fi
  44  
  45  (
  46      echo "dn: cn=$2,$PARCSRDN,$BASEDN"
  47      echo "changetype: modify"
  48      echo "replace: owner"
  49      echo "owner: cn=$1,$PRINTERSRDN,$BASEDN"
  50  ) | ldapmodify -x -D $ADMINRDN,$BASEDN -w $ADMINPW >/dev/null


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