[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3master/var/cache/se3_install/depmaj/ -> install_supervision_rouen.sh (source)

   1  #!/bin/bash
   2  WWWPATH="/var/www"
   3  if [ -e $WWWPATH/se3/includes/config.inc.php ]; then
   4      dbhost=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f 2 |cut -d \" -f 2`
   5      dbname=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbname=" | cut -d = -f 2 |cut -d \" -f 2`
   6      dbuser=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 |cut -d \" -f 2`
   7      dbpass=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 |cut -d \" -f 2`
   8  else
   9      echo "Fichier de conf inaccessible."
  10      exit 1
  11  fi
  12  
  13  GENSUPERVISION()
  14  {
  15  echo "#!/bin/bash
  16  rm -rf /tmp/maj 
  17  mkdir -p /tmp/maj
  18  cd /tmp/maj
  19  typeset -i n=\`echo \"SELECT value FROM params WHERE name='supervision_nbr';\"|mysql se3db -N\`
  20  url_maj=\`echo \"SELECT value FROM params WHERE name='supervision_url';\"|mysql se3db -N\`
  21  url_md5=\`echo \"SELECT value FROM params WHERE name='supervision_md5';\"|mysql se3db -N\`
  22  while true
  23  do
  24  fich=\"supervision-maj\$n\"
  25  echo \"téléchargement de \$fich\"
  26  wget -qc \$url_maj/\$fich.tgz
  27  wget -qc \$url_md5/\$fich.md5
  28  
  29  if [ -e \$fich.tgz ]; then
  30        echo \"téléchargement de \$fich terminé\"
  31        MD5_CONTROL=\`cat \$fich.md5\`
  32        MD5_FILE=\`md5sum \$fich.tgz\`
  33        if [ \"\$MD5_CONTROL\" == \"\$MD5_FILE\" ]; then
  34        tar -zxf \$fich.tgz
  35        ./maj.sh
  36        echo \"supervision - mise a jour #\$n terminée\"
  37        else
  38        echo \"Erreur de CRC sur \$fich\"
  39        exit 1
  40        fi
  41        let n+=1
  42  else
  43      mysql -D se3db -e \"UPDATE params SET value=\$n WHERE name='supervision_nbr';\"
  44      echo \"Opération de mise a jour de la supervision terminée\"
  45      exit 0
  46  fi
  47  done ">/usr/sbin/supervision_rouen.sh
  48  
  49  
  50  
  51  cat >/etc/cron.d/se3_supervision_rouen <<END
  52  30 7 * * 1-5 root /usr/sbin/supervision_rouen.sh >/dev/null 2>&1
  53  END
  54  
  55  chmod 700 /usr/sbin/supervision_rouen.sh
  56  }
  57  mysql_cnx="mysql -u $dbuser -p$dbpass -D se3db"
  58  if [ ! -z "$(hostname -d | grep -i "ac-rouen.fr")" ]; then
  59      echo "Installation des mises a jour / supervision made in rouen"
  60      paraminst=`echo "SELECT count(*) FROM params WHERE name='supervision_nbr';" | $mysql_cnx -N`
  61      if [ "$paraminst" = "0" ]; then
  62          $mysql_cnx -e "INSERT INTO params VALUES ('','supervision_nbr',0,0,'indice de maj supervision',4);"
  63      fi
  64      
  65      paraminst=`echo "SELECT count(*) FROM params WHERE name='supervision_url';" | $mysql_cnx -N`
  66      if [ "$paraminst" = "0" ]; then
  67          $mysql_cnx -e "INSERT INTO params VALUES ('','supervision_url','http://lcs.ac-rouen.fr/se3',0,'url de maj supervision',4);"
  68      fi
  69  
  70      paraminst=`echo "SELECT count(*) FROM params WHERE name='supervision_md5';" | $mysql_cnx -N`
  71      if [ "$paraminst" = "0" ]; then
  72          $mysql_cnx -e "INSERT INTO params VALUES ('','supervision_md5','http://wawadeb.crdp.ac-caen.fr/se3/md5',0,'url somme md5 supervision',4);"
  73      fi
  74      GENSUPERVISION
  75  
  76  fi
  77  
  78  
  79  
  80  
  81  
  82  


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