[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  #!/bin/bash
   2  #
   3  ##### Script de sauvegarde de divers paramètres SE3 #####
   4  #
   5  # Auteur : Stephane Boireau (Bernay/Pont-Audemer (27))
   6  #
   7  ## $Id ##
   8  #
   9  # Dernière modif: 07/04/2007
  10  
  11  if [ "$1" = "--help" -o "$1" = "-h" ]; then
  12      echo "Script permettant de consulter la configuration MySQL"
  13      echo "dans se3db pour lancer la sauvegarde:"
  14      echo " - de l'annuaire LDAP"
  15      echo " - de /etc"
  16      echo " - des bases MySQL suivantes: 'se3db' et 'mysql'"
  17      echo " - de /var/lib/samba ou juste /var/lib/samba/secrets.tdb"
  18      echo ""
  19      echo "Usage : Lancer sans paramètres"
  20      exit
  21  fi
  22  
  23  # Fix Lenny
  24  export LANG=fr_FR.UTF-8
  25  
  26  #
  27  # Récupération des paramètres mysql
  28  #
  29  if [ -e /var/www/se3/includes/config.inc.php ]; then
  30      dbhost=`cat /var/www/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f 2 |cut -d \" -f 2`
  31      dbname=`cat /var/www/se3/includes/config.inc.php | grep "dbname=" | cut -d = -f 2 |cut -d \" -f 2`
  32      dbuser=`cat /var/www/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 |cut -d \" -f 2`
  33      dbpass=`cat /var/www/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 |cut -d \" -f 2`
  34  else
  35      echo "Fichier de conf inaccessible"
  36      # ENVOYER UN MAIL... A FAIRE
  37      exit 1
  38  fi
  39  
  40  #
  41  # Récupération des paramètres de sauvegarde
  42  #
  43  svgsyst_cnsv_hebdo=`echo "SELECT value FROM params WHERE name='svgsyst_cnsv_hebdo'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N`
  44  svgsyst_varlibsamba=`echo "SELECT value FROM params WHERE name='svgsyst_varlibsamba'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N`
  45  svgsyst_aclvarse3=`echo "SELECT value FROM params WHERE name='svgsyst_aclvarse3'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N`
  46  svgsyst_timeout=`echo "SELECT value FROM params WHERE name='svgsyst_timeout'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N`
  47  
  48  if [ -z "$svgsyst_cnsv_hebdo" ]; then
  49      svgsyst_cnsv_hebdo="0"
  50  fi
  51  
  52  if [ -z "$svgsyst_varlibsamba" ]; then
  53      svgsyst_varlibsamba="0"
  54  fi
  55  
  56  if [ -z "$svgsyst_aclvarse3" ]; then
  57      svgsyst_aclvarse3="1"
  58  fi
  59  
  60  if [ -z "$svgsyst_timeout" ]; then
  61      svgsyst_timeout="4500"
  62  else
  63      # Contrôler que c'est bien un nombre
  64      test=$(echo $svgsyst_timeout | sed -e "s/[0-9]//g")
  65      if [ ! -z "$test" ]; then
  66          svgsyst_timeout="4500"
  67      fi
  68  fi
  69  
  70  options=""
  71  if [ "$svgsyst_cnsv_hebdo" = "1" ]; then
  72      options="$options conservation_hebdo"
  73  fi
  74  if [ "$svgsyst_varlibsamba" = "1" ]; then
  75      options="$options varlibsamba"
  76  fi
  77  if [ "$svgsyst_aclvarse3" = "0" ]; then
  78      options="$options noacl"
  79  fi
  80  
  81  #
  82  # Lancement de la sauvegarde
  83  #
  84  #echo /usr/share/se3/sbin/sauve_system.sh $svgsyst_timeout $options forcer
  85  /usr/share/se3/sbin/sauve_system.sh $svgsyst_timeout $options forcer > /dev/null 2>&1
  86  


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