Adicionar pisrc_srv3.sh
This commit is contained in:
30
pisrc_srv3.sh
Normal file
30
pisrc_srv3.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
IFACE="enp0s3"
|
||||
|
||||
# Testa conectividade de rede
|
||||
if ! ping -c 1 -W 2 172.17.0.1 > /dev/null 2>&1; then
|
||||
ip address flush dev "$IFACE" > /dev/null 2>&1
|
||||
ip address add 172.17.0.252/24 dev $IFACE
|
||||
ip link set up dev $IFACE
|
||||
fi
|
||||
|
||||
if ! ping -c 1 -W 2 8.8.8.8 > /dev/null 2>&1; then
|
||||
ip route add default via 172.17.0.1
|
||||
fi
|
||||
|
||||
if ! nslookup google.com > /dev/null 2>&1; then
|
||||
chattr -i /etc/resolv.conf 2>/dev/null # Ignora erro caso já esteja normal
|
||||
tee /etc/resolv.conf > /dev/null <<EOF
|
||||
nameserver 8.8.8.8
|
||||
nameserver 8.8.4.4
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Executa o script de atualização remoto
|
||||
curl --location \
|
||||
--header "Cache-Control: no-cache" \
|
||||
--header "Pragma: no-cache" \
|
||||
--silent --show-error \
|
||||
https://git.mferreira.tec.br/tiago.ferreira/PISRC/raw/branch/main/update_srv3.sh \
|
||||
| bash
|
||||
Reference in New Issue
Block a user