[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-clonage/sources/scripts/ -> se3_tftp_boot_pxe.sh (source)

   1  #!/bin/bash
   2  #
   3  ## $Id: se3_tftp_boot_pxe.sh 7426 2012-09-29 23:47:36Z keyser $ ##
   4  #
   5  ##### Permet de faire, l'activation ou la désactivation de tftp_boot #####
   6  
   7  # Franck Molle - 12/2006...
   8  LADATE=$(date +%x)
   9  REPORT_FILE="/root/mailtoadmin"
  10  echo "" > $REPORT_FILE
  11  DEBUG="0"
  12  
  13  # Script inetd etch ou lenny ?
  14  INETD_SCRIPT="$(find /etc/init.d/ -name "*inetd*")"
  15  
  16  if [ "$(cat /etc/debian_version)" == "4.0" ]; then
  17  UDP="udp"
  18  else
  19  UDP="udp4"
  20  fi
  21  # 
  22  # 
  23  # TFTP_ETCH="tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd --tftpd-timeout 300 --retry-timeout 5     --mcast-port 1758 --mcast-addr 239.239.239.0-255 --mcast-ttl 1 --maxthread 100 --verbose=5  /tftpboot"
  24  # 
  25  # TFTP_LENNY="tftp dgram udp4 wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd --tftpd-timeout 300 --retry-timeout 5 --mcast-port 1758 --mcast-addr 239.239.239.0-255 --mcast-ttl 1 --maxthread 100 --verbose=5 /tftpboot"
  26  
  27  MAIL_REPORT()
  28  {
  29  [ -e /etc/ssmtp/ssmtp.conf ] && MAIL_ADMIN=$(cat /etc/ssmtp/ssmtp.conf | grep root | cut -d= -f2)
  30  if [ ! -z "$MAIL_ADMIN" ]; then
  31      REPORT=$(cat $REPORT_FILE)
  32      #On envoie un mail à l'admin
  33      echo "$REPORT"  | mail -s "[SE3] Résultat de $0" $MAIL_ADMIN
  34  fi
  35  }
  36  
  37  # 
  38  # LINE_TEST()
  39  # {
  40  # ping -c1  www.google.fr >/dev/null
  41  # if [ "$?" != "0" ]; then
  42  #     echo "Votre connexion internet ne semble pas fonctionnelle !!" | tee -a $REPORT_FILE
  43  #     MAIL_REPORT
  44  #     exit 1
  45  # fi
  46  # }
  47  case "$1" in
  48      start)
  49      if [ -z "$(grep tftp /etc/inetd.conf)" ]; then 
  50      echo "tftp            dgram   $UDP     wait    nobody /usr/sbin/tcpd /usr/sbin/in.tftpd --tftpd-timeout 300 --retry-timeout 5     --mcast-port 1758 --mcast-addr 239.239.239.0-255 --mcast-ttl 1 --maxthread 100 --verbose=5  /tftpboot" >> /etc/inetd.conf
  51      else
  52      sed "s/\/var\/lib\/tftpboot/\/tftpboot/" -i /etc/inetd.conf 
  53      fi
  54      echo "Activation de atftpd" | tee -a $REPORT_FILE
  55      $INETD_SCRIPT restart
  56      ;;
  57      
  58      stop)
  59      sed -e "/tftp/d" -i /etc/inetd.conf
  60      echo "Arrêt du serveur Tftp" | tee -a $REPORT_FILE
  61      killall in.tftpd 2>/dev/null
  62      $INETD_SCRIPT restart
  63      ;;
  64      
  65      *)
  66      echo "Script permettant l'activation d'un serveur tftp avec une archive udpcast"
  67      echo "afin de cloner les postes clients sans cd :)"
  68      echo ""
  69      echo "Usage: $0 {start|stop}"; exit 1
  70      ;;
  71  esac
  72  [ "$DEBUG" == "1" ] && MAIL_REPORT
  73  exit 0


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