Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # UpDate 23/04/2019
- # STRYK
- DefRole () {
- if [ $(role) != "MAIN" ]; then
- echo -e "Cet utilitaire doit être utilisé sur la \033[41mcpu MAIN\033[0m"
- exit
- fi
- }
- GoAction () {
- CountList=0
- MaxIpt=$(tool ippstat status set | grep -c OK)
- echo -e "\033[05;01;32;44mRécupération des informations des IpTouch en cours\033[0m"
- # Clear LogFile
- echo "Mcdu;Nom;Prenom;Type;@IP;Serial">CustomEdsbr.csv
- for Mcdu in `tool ippstat mac | grep Ipt | cut -d '|' -f 5`; do
- InStat=$(tool terminfo d $Mcdu | grep SERVICE | cut -d '|' -f 4 | cut -d " " -f 2)
- if [ $InStat = "IN" ]; then
- 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-)
- 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-)
- 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-)
- DevAdip=$(tool ippstat status d $Mcdu | grep "IP Address is" | cut -d ':' -f 2)
- 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-)
- CountList=$(($CountList + 1))
- echo "$Mcdu;$DevName;$DevFirstName;$DevType;$DevAdip;$DevSN" >>CustomEdsbr.csv
- fi
- done
- echo Travail terminé - $CountList Postes Listés sur un total de $MaxIpt!
- echo Fichier disponible: /usr2/mtcl/CustomEdsbr.csv
- }
- DefRole
- GoAction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement