faire un dyndns perso
depuis un raspberry
Discussions Libres

thierryR Membre non connecté
-
- Voir le profil du membre thierryR
- Inscrit le : 02/02/2010
- Site internet
Reprise du message précédent
Mon script fonctionnant, je confirme que l'IP_FAI change tous les 3 jours. Sauf aujourd'hui où elle a déjà changé 2 fois. Pour la fibre, il y a surement une autre philosophie. Je n'en fais pas partie.Mon petit système fonctionne à merveille. Il me manque la mise à jour automatique du fichier host qui me rendrait la chose transparente.
Je pense qu'il faut un webmail en PHP pour récupérer le message via le serveur imap puis faire un script utilisant "sed" pour mettre à jour le fichier.
C'est bien ça ?
débusqueur de bugs et chercheur en améliorations
Amicalement vôtre.
Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

thierryR Membre non connecté
-
- Voir le profil du membre thierryR
- Inscrit le : 02/02/2010
- Site internet
Code BASH :
#!/bin/bash DIR_MAIL = ".thunderbird/3mfwda1b.default/ImapMail/imap.googlemail-3.com/[Gmail].sbd/" #Vérification du dossier thunderbird if [ !-d "~/.thunderbird" ] # dossier n'existe pas. then echo "Le dossier thunderbird n'existe pas ou n'est pas accessible" exit; fi cd $DIR_MAIL #Verification du fichier if ! [ -f "raspberry" ]; #fichier n'existe pas. then echo "Le fichier raspberry n'est pas accessible" exit fi echo "Le fichier raspberry est trouvé"; # récupération de l'ancienne IP. old-ip = cat /etc/hosts |grep Sauvegarde|sed 's/.* {[0-9]{2}.[0-9]{2}.[0-9]{2}.[0-9]{2} } /1/' # exemple: 79.84.85.26 Sauvegarde # recherche de cet IP dans raspberry cde = cat raspberry |grep $old-ip # exemple de ligne trouvée: s/79.84.85.26/79.84.35.235/g # Passage en root root(){ whoami } while $(root) in root ) do echo "" ;; else echo "Vous devez vous logger en root pour poursuivre ce script (#) ";; done sed -e "$cde" -i /etc/hosts; exit 0;
Il semble que ce truc compliqué ne marche pas.... Je n'y arrive pas avec les regex - sed
cat /etc/hosts |grep Sauvegarde|sed 's/.* {[0-9]{2}.[0-9]{2}.[0-9]{2}.[0-9]{2} } /1/'
sed: -e expression n°1, caractère 56: Échec du pairage de {
De plus mon dernier nombre peut 2 ou 3 chiffres.
Si un spécialiste peut m'aider. Merci.
débusqueur de bugs et chercheur en améliorations
Amicalement vôtre.
Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie