Adicionar pisrc_router.sh

This commit is contained in:
2026-02-08 04:10:46 +00:00
parent ff84ac049b
commit be5658001d

27
pisrc_router.sh Normal file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
IFACE="enp0s3"
# Testa conectividade de rede
if ! ping -c 1 -W 2 8.8.8.8 > /dev/null 2>&1; then
ip address flush dev "$IFACE" > /dev/null 2>&1
dhclient -r "$IFACE" > /dev/null 2>&1
dhclient "$IFACE"
fi
# Se após isso o DNS ainda falhar, reconfigura o resolv.conf
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.tfmerreira.tec.br/tiago.ferreira/ASDR/raw/branch/main/update_srv1.sh \
| bash