[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  #!/bin/bash
   2  
   3  #
   4  ## $Id: settime.sh 6654 2011-11-27 16:35:54Z dbo $ ##
   5  #
   6  ##### Met la machine à l'heure à partir du serveur de temps indiqué dans la base MySQL #####
   7  #
   8  
   9  
  10  if [ "$1" = "--help" -o "$1" = "-h" ]
  11  then
  12      echo "Met la machine à l'heure à partir du serveur de temps indiqué dans la base MySQL"
  13      echo "Usage : aucune option"
  14      exit
  15  fi    
  16  
  17  # Détection de la distrib
  18  if [ -e /etc/redhat-release ]; then
  19          DISTRIB="RH"
  20          WWWPATH="/var/www/html"
  21  fi
  22  if [ -e /etc/mandrake-release ]; then
  23          DISTRIB="MDK"
  24          WWWPATH="/var/www/html"
  25  fi
  26  if [ -e /etc/debian_version ]; then
  27          DISTRIB="DEB"
  28          WWWPATH="/var/www"
  29  fi
  30  
  31  # Récupération des paramètres mysql
  32  
  33  if [ -e $WWWPATH/se3/includes/config.inc.php ]; then
  34          dbhost=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f 2 |cut -d \" -f 2`
  35          dbname=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbname=" | cut -d = -f 2 |cut -d \" -f 2`
  36          dbuser=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 |cut -d \" -f 2`
  37          dbpass=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 |cut -d \" -f 2`
  38  else
  39          echo "Fichier de conf inaccessible" >> $SE3LOG
  40          echo "settime.sh: Status FAILED" >> $SE3LOG
  41          exit 1
  42  fi
  43  
  44  NTPSERV=`echo "SELECT value FROM params WHERE name='ntpserv'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N`
  45  
  46  /usr/sbin/ntpdate -s -b $NTPSERV


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