Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.60 KB | None | 0 0
  1. #!/bin/sh
  2. # UpDate 23/04/2019
  3. # STRYK
  4.  
  5. DefRole () {
  6.    
  7.     if [ $(role) != "MAIN" ]; then
  8.    
  9.         echo -e "Cet utilitaire doit être utilisé sur la \033[41mcpu MAIN\033[0m"
  10.         exit
  11.        
  12.     fi
  13.    
  14. }
  15.  
  16. GoAction () {
  17.  
  18.     CountList=0
  19.     MaxIpt=$(tool ippstat status set | grep -c OK)
  20.     echo -e "\033[05;01;32;44mRécupération des informations des IpTouch en cours\033[0m"
  21.    
  22.     # Clear LogFile
  23.     echo "Mcdu;Nom;Prenom;Type;@IP;Serial">CustomEdsbr.csv
  24.  
  25.     for Mcdu in `tool ippstat mac | grep Ipt | cut -d '|' -f 5`; do
  26.    
  27.         InStat=$(tool terminfo d $Mcdu | grep SERVICE | cut -d '|' -f 4 | cut -d " " -f 2)
  28.        
  29.         if [ $InStat = "IN" ]; then
  30.  
  31.             DevName=$(echo -e 'Subscriber\n4\n1\n3\nAnnu_Name\n\n2\n'$Mcdu'\n' | mgr -line -nodico | grep 'Annu_Name' | cut -d ':' -f2 | cut -c 2-)
  32.             DevFirstName=$(echo -e 'Subscriber\n4\n1\n3\nAnnu_First_Name\n\n2\n'$Mcdu'\n' | mgr -line -nodico | grep 'Annu_First_Name' | cut -d ':' -f2 | cut -c 2-)
  33.             DevType=$(echo -e 'Subscriber\n4\n1\n3\nStation_Type\n\n2\n'$Mcdu'\n' | mgr -line -nodico | grep 'Station_Type' | cut -d ':' -f2 | cut -c 2-)
  34.             DevAdip=$(tool ippstat status d $Mcdu | grep "IP Address is" | cut -d ':' -f 2)
  35.             DevSN=$(echo -e 'Noe_Parameters\n4\n1\n'$Mcdu'\n3\nSerial_Number\n\n2\n\n' | mgr -line -nodico | grep 'Serial_Number' | sort -u | cut -d ':' -f2 | cut -c 2-)
  36.  
  37.             CountList=$(($CountList + 1))
  38.            
  39.             echo "$Mcdu;$DevName;$DevFirstName;$DevType;$DevAdip;$DevSN" >>CustomEdsbr.csv
  40.            
  41.         fi
  42.        
  43.     done
  44.    
  45.     echo Travail terminé - $CountList Postes Listés sur un total de $MaxIpt!
  46.     echo Fichier disponible: /usr2/mtcl/CustomEdsbr.csv
  47.    
  48. }
  49.  
  50. DefRole
  51. GoAction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement