Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash -x
- #Script que monitorea que la partici�n /STORAGE/C1 del equipo Cerebro1 esté montada
- #en este servidor de manera local.
- #VARIABLES
- #IP del servidor sshfs
- IPSSHFS="10.12.102.60"
- IPGOOG="8.8.8.8"
- #Revisi�n de que la partici�n estémontada
- /usr/bin/df -h | /usr/bin/grep "/STORAGE/C1"
- #Variable que contiene el dato validador de la particion montada
- VAL=$(echo $?)
- if [ $VAL -ne 0 ]
- then
- /usr/bin/ping -c2 $IPSSHFS
- #Variable que contiene el dato validador del ping al servidor remoto
- VFS=$(echo $?)
- echo "Empieza el segundo condicional"
- #Inicia el condicional para montar la particion
- if [ $VFS -eq 0 ]
- then
- #Montamos todas las particiones
- /usr/bin/mount -a
- sleep 10
- #Revisamos que este montada la particion
- /usr/bin/df -h | /usr/bin/grep "/STORAGE/C1"
- VAL2=$(echo $?)
- if [ $VAL2 -eq 0 ]
- then
- #Enviar correo de aviso que se monto
- else
- #Enviar correo de aviso que no se pudo montar
- fi
- else
- #Hacer ping a google para ver que haya internet y corroborar que el
- #Switch no este apagado
- /usr/bin/ping -c2 $IPGOOG
- VAL3=$(echo $?)
- #Condicional para la revision de internet
- if [ $VAL3 -eq 0 ]
- then
- #Enviar mensaje que si hay internet y no se pudo montar
- else
- #Enviar mensaje que no hay internet
- fi
- fi
- else
- echo "La particion esta montada"
- fi
- -------------------------------------------------
- Error que muestra es:
- [sysadmin@cerebro2:~/.SCRIPTS/cerebros/cer2]$ ./monitoreo_sshfs.sh
- + IPSSHFS=10.12.102.60
- + IPGOOG=8.8.8.8
- + /usr/bin/df -h
- + /usr/bin/grep /STORAGE/C1
- root@10.12.102.60:/STORAGE/C1 3.6T 614G 2.9T 18% /STORAGE/C1
- ++ echo 0
- + VAL=0
- ./monitoreo_sshfs.sh: line 32: syntax error near unexpected token `else'
- ./monitoreo_sshfs.sh: line 32: ` else'
- [sysadmin@cerebro2:~/.SCRIPTS/cerebros/cer2]$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement