<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>http://www.yakakliker.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Administrateur</id>
	<title>www.yakakliker.org - Contributions [fr]</title>
	<link rel="self" type="application/atom+xml" href="http://www.yakakliker.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Administrateur"/>
	<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php/Sp%C3%A9cial:Contributions/Administrateur"/>
	<updated>2026-11-19T14:30:09Z</updated>
	<subtitle>Contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Accueil&amp;diff=2328</id>
		<title>Accueil</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Accueil&amp;diff=2328"/>
		<updated>2026-11-19T09:24:01Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Tutoriels ==&lt;br /&gt;
&lt;br /&gt;
* [[Installation &amp;amp; paramétrages de GLPI]]&lt;br /&gt;
* [[Installation de PhpMyFaq sur Ubuntu 22.04]]&lt;br /&gt;
* [[Installation de Mediawiki sur Ubuntu 22.04]]&lt;br /&gt;
* [[Installation de Smokeping]]&lt;br /&gt;
* [[Installation de Fail2ban]]&lt;br /&gt;
* [[Zerotier : Installation d&#039;un contrôleur]]&lt;br /&gt;
* [[Installation de Guacamole sur Ubuntu]]&lt;br /&gt;
* [[Gitlab : Installation]]&lt;br /&gt;
* [[Gluster : Procédure d&#039;installation Gluster sur un cluster Proxmox via une infrastructure VPN Zerotier]]&lt;br /&gt;
* [[Python : Création d&#039;un environnement virtuel Python / Gunicorn|Création d&#039;un environnement virtuel Python / Gunicorn]]&lt;br /&gt;
* [[Gluster : Création d&#039;un cluster Glusterfs|Création d&#039;un cluster Glusterfs]]&lt;br /&gt;
* [[Linux : Securiser un serveur Linux|Securiser un serveur Linux]]&lt;br /&gt;
* [[Tuto : Installation de Prometheus / Grafana|Installation de Prometheus / Grafana]]&lt;br /&gt;
* [[Python : Création d&#039;un environnement virtuel Python / Gunicorn|Création d&#039;un environnement virtuel Python / Gunicorn]]&lt;br /&gt;
* [[Python : Création d&#039;un repository python Devpi-server|Création d&#039;un repository python Devpi-server]]&amp;lt;br /&amp;gt;&lt;br /&gt;
== Catégories ==&lt;br /&gt;
&lt;br /&gt;
* [[:Catégorie:Apache2|Apache2]]&lt;br /&gt;
* [[:Catégorie:Scripts|Scripts]]&lt;br /&gt;
* [[:Catégorie:Fail2ban|Fail2ban]]&lt;br /&gt;
* [[:Catégorie:Crowdsec|Crowdsec]]&lt;br /&gt;
* [[:Catégorie:Securite|Securite]]&lt;br /&gt;
* [[:Catégorie:Linux|Linux]]&lt;br /&gt;
* [[:Catégorie:Proxmox|Proxmox]]&lt;br /&gt;
* [[:Catégorie:Haproxy|Haproxy]]&lt;br /&gt;
* [[:Catégorie:Zerotier|Zerotier]]&lt;br /&gt;
* [[:Catégorie:Mikrotik|Mikrotik]]&lt;br /&gt;
* [[:Catégorie:Opnsense|Opnsense]]&lt;br /&gt;
* [[:Catégorie:Ubuntu|Ubuntu]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Yakakliker ==&lt;br /&gt;
&lt;br /&gt;
* [https://openproject.yakakliker.org Openproject]&lt;br /&gt;
* [https://passbolt.yakakliker.org Passbolt]&lt;br /&gt;
* [[Spécial:Connexion|Connexion]]&lt;br /&gt;
&lt;br /&gt;
== Quelques liens ==&lt;br /&gt;
&lt;br /&gt;
* [https://docs.frrouting.org/en/latest/overview.html Frrouting.org]&lt;br /&gt;
* https://www.zerotier.com/&lt;br /&gt;
* https://www.proxmox.com/en/&lt;br /&gt;
* [https://help.mikrotik.com/docs/ Mikrotik]&lt;br /&gt;
* https://grisebouille.net/&lt;br /&gt;
* https://journaldunadminlinux.fr/&lt;br /&gt;
* [https://iplists.firehol.org/ Blacklistes]&lt;br /&gt;
* https://fouille-mot.fr/&lt;br /&gt;
* https://stat.ripe.net/&lt;br /&gt;
* https://jami.net/&lt;br /&gt;
* https://cyber.excusesecu.fr/&lt;br /&gt;
* https://standards-oui.ieee.org/&lt;br /&gt;
* https://www.submarinecablemap.com/&lt;br /&gt;
* https://bonjourlafuite.eu.org/&lt;br /&gt;
* https://christopheboutry.com/fuites-infos/&lt;br /&gt;
* https://matrix.org/&lt;br /&gt;
* https://saracroche.org/fr/&lt;br /&gt;
* https://filigrane.beta.gouv.fr/&lt;br /&gt;
* https://www.dossierfacile.logement.gouv.fr/&lt;br /&gt;
* https://pdoom-aujourdhui.vercel.app/&lt;br /&gt;
* https://www.europarl.europa.eu/news/fr&lt;br /&gt;
* https://www.ssllabs.com/ssltest/index.html&lt;br /&gt;
&lt;br /&gt;
== Veille Techno ==&lt;br /&gt;
&lt;br /&gt;
* [https://cyber.gouv.fr/publications/recommandations-sur-le-nomadisme-numerique Recommandations sur le nomadisme numérique]&lt;br /&gt;
* [https://cyber.gouv.fr/publications/recommandations-relatives-linterconnexion-dun-si-internet Recommandations relatives à l&#039;interconnexion d&#039;un SI à Internet]&lt;br /&gt;
* [https://cyber.gouv.fr/la-directive-nis-2 La directive NIS 2]&lt;br /&gt;
* https://www.cert.ssi.gouv.fr/&lt;br /&gt;
* [https://cyber.gouv.fr/en-cas-dincident Lien d&#039;urgence en cas d&#039;incident]&lt;br /&gt;
* [[Sécurité : Les attaques par déplacement latéral]]&lt;br /&gt;
* [https://www.globalsign.com/fr/blog/90-jour-a-47-evolution-duree-de-vie-certificats Sécurité : Evolution de la durée de vie des certificats]&lt;br /&gt;
* https://www.afnic.fr/observatoire-ressources/papier-expert/faire-heberger-son-courrier-electronique-avec-son-propre-nom-de-domaine/&lt;br /&gt;
* https://nylon.jq.ax/&lt;br /&gt;
* https://nebula.defined.net/docs/&lt;br /&gt;
* https://www.afnic.fr/wp-media/uploads/2026/11/Rapport-2026-de-lObservatoire-de-la-resilience-de-linternet-francais.pdf&lt;br /&gt;
* https://www.goverbyte.fr/&lt;br /&gt;
&lt;br /&gt;
== News ==&lt;br /&gt;
&lt;br /&gt;
* https://www.lemondeinformatique.fr/publi_info/lire-alternatives-a-vmware-les-vertus-de-l-open-source-1068.html&lt;br /&gt;
* 16/04/2025 : https://www.datasecuritybreach.fr/coupure-brutale-dans-la-cybersecurite-la-base-cve-seteint/&lt;br /&gt;
* 19/11/2025 : [https://blog.cloudflare.com/fr-fr/18-november-2025-outage/ Panne géante Cloudflare, explications]&lt;br /&gt;
&lt;br /&gt;
== Alertes ==&lt;br /&gt;
&lt;br /&gt;
=== Mai 2026 ===&lt;br /&gt;
&lt;br /&gt;
* https://www.bortzmeyer.org/copyfail.html&lt;br /&gt;
* https://security-tracker.debian.org/tracker/CVE-2026-31431&lt;br /&gt;
* https://copy.fail/#copy-fail&lt;br /&gt;
* https://github.com/V4bel/dirtyfrag&lt;br /&gt;
* https://seclists.org/oss-sec/2026/q2/430&lt;br /&gt;
* https://www.bortzmeyer.org/dirtyfrag.html&lt;br /&gt;
&lt;br /&gt;
=== Septembre 2025 ===&lt;br /&gt;
&lt;br /&gt;
* https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-snmp-x4LPhte&lt;br /&gt;
&lt;br /&gt;
=== Juillet 2024 ===&lt;br /&gt;
&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/alerte/CERTFR-2024-ALE-009/ Vulnérabilité dans OpenSSH sur les version 8.5p1 à 9.7p1 (CVE-2024-6387)]&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/avis/CERTFR-2024-AVI-0533/ Multiples vulnérabilités dans Apache HTTP Server]&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/avis/CERTFR-2024-AVI-0561/ Nouvelles vulnérabilités détectées sur les produits Fortinet]&lt;br /&gt;
* https://www.cert.ssi.gouv.fr/avis/CERTFR-2025-AVI-0139/&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.abuseipdb.com/user/18731&amp;quot; title=&amp;quot;AbuseIPDB is an IP address blacklist for webmasters and sysadmins to report IP addresses engaging in abusive behavior on their networks&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;img src=&amp;quot;https://www.abuseipdb.com/contributor/18731.svg&amp;quot; alt=&amp;quot;AbuseIPDB Contributor Badge&amp;quot; style=&amp;quot;width: 401px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Accueil&amp;diff=2327</id>
		<title>Accueil</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Accueil&amp;diff=2327"/>
		<updated>2026-11-18T08:03:19Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Tutoriels ==&lt;br /&gt;
&lt;br /&gt;
* [[Installation &amp;amp; paramétrages de GLPI]]&lt;br /&gt;
* [[Installation de PhpMyFaq sur Ubuntu 22.04]]&lt;br /&gt;
* [[Installation de Mediawiki sur Ubuntu 22.04]]&lt;br /&gt;
* [[Installation de Smokeping]]&lt;br /&gt;
* [[Installation de Fail2ban]]&lt;br /&gt;
* [[Zerotier : Installation d&#039;un contrôleur]]&lt;br /&gt;
* [[Installation de Guacamole sur Ubuntu]]&lt;br /&gt;
* [[Gitlab : Installation]]&lt;br /&gt;
* [[Gluster : Procédure d&#039;installation Gluster sur un cluster Proxmox via une infrastructure VPN Zerotier]]&lt;br /&gt;
* [[Python : Création d&#039;un environnement virtuel Python / Gunicorn|Création d&#039;un environnement virtuel Python / Gunicorn]]&lt;br /&gt;
* [[Gluster : Création d&#039;un cluster Glusterfs|Création d&#039;un cluster Glusterfs]]&lt;br /&gt;
* [[Linux : Securiser un serveur Linux|Securiser un serveur Linux]]&lt;br /&gt;
* [[Tuto : Installation de Prometheus / Grafana|Installation de Prometheus / Grafana]]&lt;br /&gt;
* [[Python : Création d&#039;un environnement virtuel Python / Gunicorn|Création d&#039;un environnement virtuel Python / Gunicorn]]&lt;br /&gt;
* [[Python : Création d&#039;un repository python Devpi-server|Création d&#039;un repository python Devpi-server]]&amp;lt;br /&amp;gt;&lt;br /&gt;
== Catégories ==&lt;br /&gt;
&lt;br /&gt;
* [[:Catégorie:Apache2|Apache2]]&lt;br /&gt;
* [[:Catégorie:Scripts|Scripts]]&lt;br /&gt;
* [[:Catégorie:Fail2ban|Fail2ban]]&lt;br /&gt;
* [[:Catégorie:Crowdsec|Crowdsec]]&lt;br /&gt;
* [[:Catégorie:Securite|Securite]]&lt;br /&gt;
* [[:Catégorie:Linux|Linux]]&lt;br /&gt;
* [[:Catégorie:Proxmox|Proxmox]]&lt;br /&gt;
* [[:Catégorie:Haproxy|Haproxy]]&lt;br /&gt;
* [[:Catégorie:Zerotier|Zerotier]]&lt;br /&gt;
* [[:Catégorie:Mikrotik|Mikrotik]]&lt;br /&gt;
* [[:Catégorie:Opnsense|Opnsense]]&lt;br /&gt;
* [[:Catégorie:Ubuntu|Ubuntu]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Yakakliker ==&lt;br /&gt;
&lt;br /&gt;
* [https://openproject.yakakliker.org Openproject]&lt;br /&gt;
* [https://passbolt.yakakliker.org Passbolt]&lt;br /&gt;
* [[Spécial:Connexion|Connexion]]&lt;br /&gt;
&lt;br /&gt;
== Quelques liens ==&lt;br /&gt;
&lt;br /&gt;
* [https://docs.frrouting.org/en/latest/overview.html Frrouting.org]&lt;br /&gt;
* https://www.zerotier.com/&lt;br /&gt;
* https://www.proxmox.com/en/&lt;br /&gt;
* [https://help.mikrotik.com/docs/ Mikrotik]&lt;br /&gt;
* https://grisebouille.net/&lt;br /&gt;
* https://journaldunadminlinux.fr/&lt;br /&gt;
* [https://iplists.firehol.org/ Blacklistes]&lt;br /&gt;
* https://fouille-mot.fr/&lt;br /&gt;
* https://stat.ripe.net/&lt;br /&gt;
* https://jami.net/&lt;br /&gt;
* https://cyber.excusesecu.fr/&lt;br /&gt;
* https://standards-oui.ieee.org/&lt;br /&gt;
* https://www.submarinecablemap.com/&lt;br /&gt;
* https://bonjourlafuite.eu.org/&lt;br /&gt;
* https://christopheboutry.com/fuites-infos/&lt;br /&gt;
* https://matrix.org/&lt;br /&gt;
* https://saracroche.org/fr/&lt;br /&gt;
* https://filigrane.beta.gouv.fr/&lt;br /&gt;
* https://www.dossierfacile.logement.gouv.fr/&lt;br /&gt;
* https://pdoom-aujourdhui.vercel.app/&lt;br /&gt;
* https://www.europarl.europa.eu/news/fr&lt;br /&gt;
* https://www.ssllabs.com/ssltest/index.html&lt;br /&gt;
&lt;br /&gt;
== Veille Techno ==&lt;br /&gt;
&lt;br /&gt;
* [https://cyber.gouv.fr/publications/recommandations-sur-le-nomadisme-numerique Recommandations sur le nomadisme numérique]&lt;br /&gt;
* [https://cyber.gouv.fr/publications/recommandations-relatives-linterconnexion-dun-si-internet Recommandations relatives à l&#039;interconnexion d&#039;un SI à Internet]&lt;br /&gt;
* [https://cyber.gouv.fr/la-directive-nis-2 La directive NIS 2]&lt;br /&gt;
* https://www.cert.ssi.gouv.fr/&lt;br /&gt;
* [https://cyber.gouv.fr/en-cas-dincident Lien d&#039;urgence en cas d&#039;incident]&lt;br /&gt;
* [[Sécurité : Les attaques par déplacement latéral]]&lt;br /&gt;
* [https://www.globalsign.com/fr/blog/90-jour-a-47-evolution-duree-de-vie-certificats Sécurité : Evolution de la durée de vie des certificats]&lt;br /&gt;
* https://www.afnic.fr/observatoire-ressources/papier-expert/faire-heberger-son-courrier-electronique-avec-son-propre-nom-de-domaine/&lt;br /&gt;
* https://nylon.jq.ax/&lt;br /&gt;
* https://nebula.defined.net/docs/&lt;br /&gt;
* https://www.afnic.fr/wp-media/uploads/2026/11/Rapport-2026-de-lObservatoire-de-la-resilience-de-linternet-francais.pdf&lt;br /&gt;
&lt;br /&gt;
== News ==&lt;br /&gt;
&lt;br /&gt;
* https://www.lemondeinformatique.fr/publi_info/lire-alternatives-a-vmware-les-vertus-de-l-open-source-1068.html&lt;br /&gt;
* 16/04/2025 : https://www.datasecuritybreach.fr/coupure-brutale-dans-la-cybersecurite-la-base-cve-seteint/&lt;br /&gt;
* 19/11/2025 : [https://blog.cloudflare.com/fr-fr/18-november-2025-outage/ Panne géante Cloudflare, explications]&lt;br /&gt;
&lt;br /&gt;
== Alertes ==&lt;br /&gt;
&lt;br /&gt;
=== Mai 2026 ===&lt;br /&gt;
&lt;br /&gt;
* https://www.bortzmeyer.org/copyfail.html&lt;br /&gt;
* https://security-tracker.debian.org/tracker/CVE-2026-31431&lt;br /&gt;
* https://copy.fail/#copy-fail&lt;br /&gt;
* https://github.com/V4bel/dirtyfrag&lt;br /&gt;
* https://seclists.org/oss-sec/2026/q2/430&lt;br /&gt;
* https://www.bortzmeyer.org/dirtyfrag.html&lt;br /&gt;
&lt;br /&gt;
=== Septembre 2025 ===&lt;br /&gt;
&lt;br /&gt;
* https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-snmp-x4LPhte&lt;br /&gt;
&lt;br /&gt;
=== Juillet 2024 ===&lt;br /&gt;
&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/alerte/CERTFR-2024-ALE-009/ Vulnérabilité dans OpenSSH sur les version 8.5p1 à 9.7p1 (CVE-2024-6387)]&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/avis/CERTFR-2024-AVI-0533/ Multiples vulnérabilités dans Apache HTTP Server]&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/avis/CERTFR-2024-AVI-0561/ Nouvelles vulnérabilités détectées sur les produits Fortinet]&lt;br /&gt;
* https://www.cert.ssi.gouv.fr/avis/CERTFR-2025-AVI-0139/&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.abuseipdb.com/user/18731&amp;quot; title=&amp;quot;AbuseIPDB is an IP address blacklist for webmasters and sysadmins to report IP addresses engaging in abusive behavior on their networks&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;img src=&amp;quot;https://www.abuseipdb.com/contributor/18731.svg&amp;quot; alt=&amp;quot;AbuseIPDB Contributor Badge&amp;quot; style=&amp;quot;width: 401px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2326</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2326"/>
		<updated>2026-11-17T09:31:24Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configurer et sécuriser le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
== Mise en place du point de montage ==&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
== Liens ==&lt;br /&gt;
* J&#039;ai fait un petit script pour les flemmards, il vous suffira de saisir l&#039;adresse du NAS, le nom du partage, le point de montage et l&#039;authentification : &lt;br /&gt;
&lt;br /&gt;
https://github.com/Yakakliker37/Base_info/blob/930028ee40bbf6fd32a269662db080bc42017507/partages.sh&lt;br /&gt;
&lt;br /&gt;
== Axes d&#039; évolution ==&lt;br /&gt;
&lt;br /&gt;
* Mise en place d&#039;un processus de redémarrage du service VPN si l&#039;IP n&#039;est pas joignable&lt;br /&gt;
* Une alerte ?&lt;br /&gt;
* Un rapport régulier sur le nombre de déconnexions / reconnexions ?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&lt;br /&gt;
[[Catégorie:VPN]]&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2325</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2325"/>
		<updated>2026-11-17T09:30:15Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configurer et sécuriser le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
== Mise en place du point de montage ==&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
== Liens ==&lt;br /&gt;
* J&#039;ai fait un petit script pour les flemmards, il vous suffira de saisir l&#039;adresse du NAS, le nom du partage, le point de montage et l&#039;authentification : &lt;br /&gt;
&lt;br /&gt;
https://github.com/Yakakliker37/Base_info/blob/930028ee40bbf6fd32a269662db080bc42017507/partages.sh&lt;br /&gt;
&lt;br /&gt;
== Axes d&#039; évolution ==&lt;br /&gt;
&lt;br /&gt;
* Mise en place d&#039;un processus de redémarrage du service VPN si l&#039;IP n&#039;est pas joignable&lt;br /&gt;
* Une alerte ?&lt;br /&gt;
* Un rapport régulier sur le nombre de déconnexions / reconnexions ?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Accueil&amp;diff=2324</id>
		<title>Accueil</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Accueil&amp;diff=2324"/>
		<updated>2026-11-17T08:15:54Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Tutoriels ==&lt;br /&gt;
&lt;br /&gt;
* [[Installation &amp;amp; paramétrages de GLPI]]&lt;br /&gt;
* [[Installation de PhpMyFaq sur Ubuntu 22.04]]&lt;br /&gt;
* [[Installation de Mediawiki sur Ubuntu 22.04]]&lt;br /&gt;
* [[Installation de Smokeping]]&lt;br /&gt;
* [[Installation de Fail2ban]]&lt;br /&gt;
* [[Zerotier : Installation d&#039;un contrôleur]]&lt;br /&gt;
* [[Installation de Guacamole sur Ubuntu]]&lt;br /&gt;
* [[Gitlab : Installation]]&lt;br /&gt;
* [[Gluster : Procédure d&#039;installation Gluster sur un cluster Proxmox via une infrastructure VPN Zerotier]]&lt;br /&gt;
* [[Python : Création d&#039;un environnement virtuel Python / Gunicorn|Création d&#039;un environnement virtuel Python / Gunicorn]]&lt;br /&gt;
* [[Gluster : Création d&#039;un cluster Glusterfs|Création d&#039;un cluster Glusterfs]]&lt;br /&gt;
* [[Linux : Securiser un serveur Linux|Securiser un serveur Linux]]&lt;br /&gt;
* [[Tuto : Installation de Prometheus / Grafana|Installation de Prometheus / Grafana]]&lt;br /&gt;
* [[Python : Création d&#039;un environnement virtuel Python / Gunicorn|Création d&#039;un environnement virtuel Python / Gunicorn]]&lt;br /&gt;
* [[Python : Création d&#039;un repository python Devpi-server|Création d&#039;un repository python Devpi-server]]&amp;lt;br /&amp;gt;&lt;br /&gt;
== Catégories ==&lt;br /&gt;
&lt;br /&gt;
* [[:Catégorie:Apache2|Apache2]]&lt;br /&gt;
* [[:Catégorie:Scripts|Scripts]]&lt;br /&gt;
* [[:Catégorie:Fail2ban|Fail2ban]]&lt;br /&gt;
* [[:Catégorie:Crowdsec|Crowdsec]]&lt;br /&gt;
* [[:Catégorie:Securite|Securite]]&lt;br /&gt;
* [[:Catégorie:Linux|Linux]]&lt;br /&gt;
* [[:Catégorie:Proxmox|Proxmox]]&lt;br /&gt;
* [[:Catégorie:Haproxy|Haproxy]]&lt;br /&gt;
* [[:Catégorie:Zerotier|Zerotier]]&lt;br /&gt;
* [[:Catégorie:Mikrotik|Mikrotik]]&lt;br /&gt;
* [[:Catégorie:Opnsense|Opnsense]]&lt;br /&gt;
* [[:Catégorie:Ubuntu|Ubuntu]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Yakakliker ==&lt;br /&gt;
&lt;br /&gt;
* [https://openproject.yakakliker.org Openproject]&lt;br /&gt;
* [https://passbolt.yakakliker.org Passbolt]&lt;br /&gt;
* [[Spécial:Connexion|Connexion]]&lt;br /&gt;
&lt;br /&gt;
== Quelques liens ==&lt;br /&gt;
&lt;br /&gt;
* [https://docs.frrouting.org/en/latest/overview.html Frrouting.org]&lt;br /&gt;
* https://www.zerotier.com/&lt;br /&gt;
* https://www.proxmox.com/en/&lt;br /&gt;
* [https://help.mikrotik.com/docs/ Mikrotik]&lt;br /&gt;
* https://grisebouille.net/&lt;br /&gt;
* https://journaldunadminlinux.fr/&lt;br /&gt;
* [https://iplists.firehol.org/ Blacklistes]&lt;br /&gt;
* https://fouille-mot.fr/&lt;br /&gt;
* https://stat.ripe.net/&lt;br /&gt;
* https://jami.net/&lt;br /&gt;
* https://cyber.excusesecu.fr/&lt;br /&gt;
* https://standards-oui.ieee.org/&lt;br /&gt;
* https://www.submarinecablemap.com/&lt;br /&gt;
* https://bonjourlafuite.eu.org/&lt;br /&gt;
* https://christopheboutry.com/fuites-infos/&lt;br /&gt;
* https://matrix.org/&lt;br /&gt;
* https://saracroche.org/fr/&lt;br /&gt;
* https://filigrane.beta.gouv.fr/&lt;br /&gt;
* https://www.dossierfacile.logement.gouv.fr/&lt;br /&gt;
* https://pdoom-aujourdhui.vercel.app/&lt;br /&gt;
* https://www.europarl.europa.eu/news/fr&lt;br /&gt;
* https://www.ssllabs.com/ssltest/index.html&lt;br /&gt;
&lt;br /&gt;
== Veille Techno ==&lt;br /&gt;
&lt;br /&gt;
* [https://cyber.gouv.fr/publications/recommandations-sur-le-nomadisme-numerique Recommandations sur le nomadisme numérique]&lt;br /&gt;
* [https://cyber.gouv.fr/publications/recommandations-relatives-linterconnexion-dun-si-internet Recommandations relatives à l&#039;interconnexion d&#039;un SI à Internet]&lt;br /&gt;
* [https://cyber.gouv.fr/la-directive-nis-2 La directive NIS 2]&lt;br /&gt;
* https://www.cert.ssi.gouv.fr/&lt;br /&gt;
* [https://cyber.gouv.fr/en-cas-dincident Lien d&#039;urgence en cas d&#039;incident]&lt;br /&gt;
* [[Sécurité : Les attaques par déplacement latéral]]&lt;br /&gt;
* [https://www.globalsign.com/fr/blog/90-jour-a-47-evolution-duree-de-vie-certificats Sécurité : Evolution de la durée de vie des certificats]&lt;br /&gt;
* https://www.afnic.fr/observatoire-ressources/papier-expert/faire-heberger-son-courrier-electronique-avec-son-propre-nom-de-domaine/&lt;br /&gt;
* https://nylon.jq.ax/&lt;br /&gt;
* https://nebula.defined.net/docs/&lt;br /&gt;
&lt;br /&gt;
== News ==&lt;br /&gt;
&lt;br /&gt;
* https://www.lemondeinformatique.fr/publi_info/lire-alternatives-a-vmware-les-vertus-de-l-open-source-1068.html&lt;br /&gt;
* 16/04/2025 : https://www.datasecuritybreach.fr/coupure-brutale-dans-la-cybersecurite-la-base-cve-seteint/&lt;br /&gt;
* 19/11/2025 : [https://blog.cloudflare.com/fr-fr/18-november-2025-outage/ Panne géante Cloudflare, explications]&lt;br /&gt;
&lt;br /&gt;
== Alertes ==&lt;br /&gt;
&lt;br /&gt;
=== Mai 2026 ===&lt;br /&gt;
&lt;br /&gt;
* https://www.bortzmeyer.org/copyfail.html&lt;br /&gt;
* https://security-tracker.debian.org/tracker/CVE-2026-31431&lt;br /&gt;
* https://copy.fail/#copy-fail&lt;br /&gt;
* https://github.com/V4bel/dirtyfrag&lt;br /&gt;
* https://seclists.org/oss-sec/2026/q2/430&lt;br /&gt;
* https://www.bortzmeyer.org/dirtyfrag.html&lt;br /&gt;
&lt;br /&gt;
=== Septembre 2025 ===&lt;br /&gt;
&lt;br /&gt;
* https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-snmp-x4LPhte&lt;br /&gt;
&lt;br /&gt;
=== Juillet 2024 ===&lt;br /&gt;
&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/alerte/CERTFR-2024-ALE-009/ Vulnérabilité dans OpenSSH sur les version 8.5p1 à 9.7p1 (CVE-2024-6387)]&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/avis/CERTFR-2024-AVI-0533/ Multiples vulnérabilités dans Apache HTTP Server]&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/avis/CERTFR-2024-AVI-0561/ Nouvelles vulnérabilités détectées sur les produits Fortinet]&lt;br /&gt;
* https://www.cert.ssi.gouv.fr/avis/CERTFR-2025-AVI-0139/&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.abuseipdb.com/user/18731&amp;quot; title=&amp;quot;AbuseIPDB is an IP address blacklist for webmasters and sysadmins to report IP addresses engaging in abusive behavior on their networks&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;img src=&amp;quot;https://www.abuseipdb.com/contributor/18731.svg&amp;quot; alt=&amp;quot;AbuseIPDB Contributor Badge&amp;quot; style=&amp;quot;width: 401px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Accueil&amp;diff=2323</id>
		<title>Accueil</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Accueil&amp;diff=2323"/>
		<updated>2026-11-17T08:13:39Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Tutoriels ==&lt;br /&gt;
&lt;br /&gt;
* [[Installation &amp;amp; paramétrages de GLPI]]&lt;br /&gt;
* [[Installation de PhpMyFaq sur Ubuntu 22.04]]&lt;br /&gt;
* [[Installation de Mediawiki sur Ubuntu 22.04]]&lt;br /&gt;
* [[Installation de Smokeping]]&lt;br /&gt;
* [[Installation de Fail2ban]]&lt;br /&gt;
* [[Zerotier : Installation d&#039;un contrôleur]]&lt;br /&gt;
* [[Installation de Guacamole sur Ubuntu]]&lt;br /&gt;
* [[Gitlab : Installation]]&lt;br /&gt;
* [[Gluster : Procédure d&#039;installation Gluster sur un cluster Proxmox via une infrastructure VPN Zerotier]]&lt;br /&gt;
* [[Python : Création d&#039;un environnement virtuel Python / Gunicorn|Création d&#039;un environnement virtuel Python / Gunicorn]]&lt;br /&gt;
* [[Gluster : Création d&#039;un cluster Glusterfs|Création d&#039;un cluster Glusterfs]]&lt;br /&gt;
* [[Linux : Securiser un serveur Linux|Securiser un serveur Linux]]&lt;br /&gt;
* [[Tuto : Installation de Prometheus / Grafana|Installation de Prometheus / Grafana]]&lt;br /&gt;
* [[Python : Création d&#039;un environnement virtuel Python / Gunicorn|Création d&#039;un environnement virtuel Python / Gunicorn]]&lt;br /&gt;
* [[Python : Création d&#039;un repository python Devpi-server|Création d&#039;un repository python Devpi-server]]&amp;lt;br /&amp;gt;&lt;br /&gt;
== Catégories ==&lt;br /&gt;
&lt;br /&gt;
* [[:Catégorie:Apache2|Apache2]]&lt;br /&gt;
* [[:Catégorie:Scripts|Scripts]]&lt;br /&gt;
* [[:Catégorie:Fail2ban|Fail2ban]]&lt;br /&gt;
* [[:Catégorie:Crowdsec|Crowdsec]]&lt;br /&gt;
* [[:Catégorie:Securite|Securite]]&lt;br /&gt;
* [[:Catégorie:Linux|Linux]]&lt;br /&gt;
* [[:Catégorie:Proxmox|Proxmox]]&lt;br /&gt;
* [[:Catégorie:Haproxy|Haproxy]]&lt;br /&gt;
* [[:Catégorie:Zerotier|Zerotier]]&lt;br /&gt;
* [[:Catégorie:Mikrotik|Mikrotik]]&lt;br /&gt;
* [[:Catégorie:Opnsense|Opnsense]]&lt;br /&gt;
* [[:Catégorie:Ubuntu|Ubuntu]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Yakakliker ==&lt;br /&gt;
&lt;br /&gt;
* [https://openproject.yakakliker.org Openproject]&lt;br /&gt;
* [https://passbolt.yakakliker.org Passbolt]&lt;br /&gt;
* [[Spécial:Connexion|Connexion]]&lt;br /&gt;
&lt;br /&gt;
== Quelques liens ==&lt;br /&gt;
&lt;br /&gt;
* [https://docs.frrouting.org/en/latest/overview.html Frrouting.org]&lt;br /&gt;
* https://www.zerotier.com/&lt;br /&gt;
* https://www.proxmox.com/en/&lt;br /&gt;
* [https://help.mikrotik.com/docs/ Mikrotik]&lt;br /&gt;
* https://grisebouille.net/&lt;br /&gt;
* https://journaldunadminlinux.fr/&lt;br /&gt;
* [https://iplists.firehol.org/ Blacklistes]&lt;br /&gt;
* https://fouille-mot.fr/&lt;br /&gt;
* https://stat.ripe.net/&lt;br /&gt;
* https://jami.net/&lt;br /&gt;
* https://cyber.excusesecu.fr/&lt;br /&gt;
* https://standards-oui.ieee.org/&lt;br /&gt;
* https://www.submarinecablemap.com/&lt;br /&gt;
* https://bonjourlafuite.eu.org/&lt;br /&gt;
* https://christopheboutry.com/fuites-infos/&lt;br /&gt;
* https://matrix.org/&lt;br /&gt;
* https://saracroche.org/fr/&lt;br /&gt;
* https://filigrane.beta.gouv.fr/&lt;br /&gt;
* https://www.dossierfacile.logement.gouv.fr/&lt;br /&gt;
* https://pdoom-aujourdhui.vercel.app/&lt;br /&gt;
* https://www.europarl.europa.eu/news/fr&lt;br /&gt;
* https://www.ssllabs.com/ssltest/index.html&lt;br /&gt;
&lt;br /&gt;
== Veille Techno ==&lt;br /&gt;
&lt;br /&gt;
* [https://cyber.gouv.fr/publications/recommandations-sur-le-nomadisme-numerique Recommandations sur le nomadisme numérique]&lt;br /&gt;
* [https://cyber.gouv.fr/publications/recommandations-relatives-linterconnexion-dun-si-internet Recommandations relatives à l&#039;interconnexion d&#039;un SI à Internet]&lt;br /&gt;
* [https://cyber.gouv.fr/la-directive-nis-2 La directive NIS 2]&lt;br /&gt;
* https://www.cert.ssi.gouv.fr/&lt;br /&gt;
* [https://cyber.gouv.fr/en-cas-dincident Lien d&#039;urgence en cas d&#039;incident]&lt;br /&gt;
* [[Sécurité : Les attaques par déplacement latéral]]&lt;br /&gt;
* [https://www.globalsign.com/fr/blog/90-jour-a-47-evolution-duree-de-vie-certificats Sécurité : Evolution de la durée de vie des certificats]&lt;br /&gt;
* https://www.afnic.fr/observatoire-ressources/papier-expert/faire-heberger-son-courrier-electronique-avec-son-propre-nom-de-domaine/&lt;br /&gt;
* https://nylon.jq.ax/&lt;br /&gt;
&lt;br /&gt;
== News ==&lt;br /&gt;
&lt;br /&gt;
* https://www.lemondeinformatique.fr/publi_info/lire-alternatives-a-vmware-les-vertus-de-l-open-source-1068.html&lt;br /&gt;
* 16/04/2025 : https://www.datasecuritybreach.fr/coupure-brutale-dans-la-cybersecurite-la-base-cve-seteint/&lt;br /&gt;
* 19/11/2025 : [https://blog.cloudflare.com/fr-fr/18-november-2025-outage/ Panne géante Cloudflare, explications]&lt;br /&gt;
&lt;br /&gt;
== Alertes ==&lt;br /&gt;
&lt;br /&gt;
=== Mai 2026 ===&lt;br /&gt;
&lt;br /&gt;
* https://www.bortzmeyer.org/copyfail.html&lt;br /&gt;
* https://security-tracker.debian.org/tracker/CVE-2026-31431&lt;br /&gt;
* https://copy.fail/#copy-fail&lt;br /&gt;
* https://github.com/V4bel/dirtyfrag&lt;br /&gt;
* https://seclists.org/oss-sec/2026/q2/430&lt;br /&gt;
* https://www.bortzmeyer.org/dirtyfrag.html&lt;br /&gt;
&lt;br /&gt;
=== Septembre 2025 ===&lt;br /&gt;
&lt;br /&gt;
* https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-snmp-x4LPhte&lt;br /&gt;
&lt;br /&gt;
=== Juillet 2024 ===&lt;br /&gt;
&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/alerte/CERTFR-2024-ALE-009/ Vulnérabilité dans OpenSSH sur les version 8.5p1 à 9.7p1 (CVE-2024-6387)]&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/avis/CERTFR-2024-AVI-0533/ Multiples vulnérabilités dans Apache HTTP Server]&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/avis/CERTFR-2024-AVI-0561/ Nouvelles vulnérabilités détectées sur les produits Fortinet]&lt;br /&gt;
* https://www.cert.ssi.gouv.fr/avis/CERTFR-2025-AVI-0139/&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.abuseipdb.com/user/18731&amp;quot; title=&amp;quot;AbuseIPDB is an IP address blacklist for webmasters and sysadmins to report IP addresses engaging in abusive behavior on their networks&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;img src=&amp;quot;https://www.abuseipdb.com/contributor/18731.svg&amp;quot; alt=&amp;quot;AbuseIPDB Contributor Badge&amp;quot; style=&amp;quot;width: 401px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2322</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2322"/>
		<updated>2026-11-15T10:45:18Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : /* Liens */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configurer et sécuriser le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
== Mise en place du point de montage ==&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
== Liens ==&lt;br /&gt;
* J&#039;ai fait un petit script pour les flemmards, il vous suffira de saisir l&#039;adresse du NAS, le nom du partage, le point de montage et l&#039;authentification : &lt;br /&gt;
&lt;br /&gt;
https://github.com/Yakakliker37/Base_info/blob/930028ee40bbf6fd32a269662db080bc42017507/partages.sh&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2321</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2321"/>
		<updated>2026-11-15T10:33:58Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configurer et sécuriser le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
== Mise en place du point de montage ==&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
== Liens ==&lt;br /&gt;
* J&#039;ai fait un petit script pour les flemmards, il vous suffira de saisir l&#039;adresse du NAS, le nom du partage, le point de montage et l&#039;authentification : &lt;br /&gt;
&lt;br /&gt;
https://github.com/Yakakliker37/Base_info/blob/e11a9e374f31b6409c85682acf86d7048c4ccebc/partages.sh&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2320</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2320"/>
		<updated>2026-11-15T10:33:33Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : /* Liens */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configurer et sécuriser le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
== Mise en place du point de montage ==&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
=== Liens ===&lt;br /&gt;
&lt;br /&gt;
* J&#039;ai fait un petit script pour les flemmards, il vous suffira de saisir l&#039;adresse du NAS, le nom du partage, le point de montage et l&#039;authentification : &lt;br /&gt;
&lt;br /&gt;
https://github.com/Yakakliker37/Base_info/blob/e11a9e374f31b6409c85682acf86d7048c4ccebc/partages.sh&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2319</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2319"/>
		<updated>2026-11-15T10:32:04Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configurer et sécuriser le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
== Mise en place du point de montage ==&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
=== Liens ===&lt;br /&gt;
&lt;br /&gt;
* J&#039;ai fait un petit script pour les flemmards : &lt;br /&gt;
&lt;br /&gt;
https://github.com/Yakakliker37/Base_info/blob/e11a9e374f31b6409c85682acf86d7048c4ccebc/partages.sh&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2318</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2318"/>
		<updated>2026-11-15T10:07:17Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configurer et sécuriser le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
== Mise en place du point de montage ==&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
=== Liens ===&lt;br /&gt;
J&#039;ai fait un petit script pour les flemmards : https://github.com/Yakakliker37/Base_info/blob/401b70a7b22d6cd7329eba16a5bcefd1bfdfb9dd/partages.sh&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Sudo_:_Lancer_un_script_Sh_en_tant_que_root_sans_mot_de_passe&amp;diff=2317</id>
		<title>Sudo : Lancer un script Sh en tant que root sans mot de passe</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Sudo_:_Lancer_un_script_Sh_en_tant_que_root_sans_mot_de_passe&amp;diff=2317"/>
		<updated>2026-11-10T09:01:22Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Objectif ===&lt;br /&gt;
L&#039;objectif est de se créer un lanceur permettant d&#039;exécuter un script en tant que root depuis un environnement utilisateur sans saisir systématiquement le mot de passe &#039;&#039;(c&#039;est chiant à la longue)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Todo ===&lt;br /&gt;
&lt;br /&gt;
* Créer le lanceur vers le script.sh sur le bureau utilisateur &lt;br /&gt;
** ex : &amp;lt;code&amp;gt;sudo sh /home/utilisateur/Documents/monscript.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
* Créer un fichier &amp;quot;utilisateur&amp;quot; dans &#039;&#039;&#039;&#039;&#039;/etc/sudoers.d/&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
** &amp;lt;code&amp;gt;sudo nano utilisateur&amp;lt;/code&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
utilisateur ALL=(root) NOPASSWD: /bin/sh /home/utilisateur/Documents/monscript.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Vérifier qu&#039;il n&#039;y a pas d&#039;erreur &lt;br /&gt;
** &amp;lt;code&amp;gt;sudo visudo -c&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
utilisateur@Xubuntu:/etc/sudoers.d$ sudo visudo -c&lt;br /&gt;
/etc/sudoers: parsed OK&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Maintenant vous pouvez lancer le script sans saisir votre mot de passe.&lt;br /&gt;
[[Catégorie:Sudo]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
[[Catégorie:Sh]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
[[Catégorie:Sudoers.d]]&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Cat%C3%A9gorie:Sudoers.d&amp;diff=2316</id>
		<title>Catégorie:Sudoers.d</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Cat%C3%A9gorie:Sudoers.d&amp;diff=2316"/>
		<updated>2026-11-10T09:00:48Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : Page vide créée&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Sudo_:_Modifier_les_droits_sudo_pour_un_utilisateur&amp;diff=2315</id>
		<title>Sudo : Modifier les droits sudo pour un utilisateur</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Sudo_:_Modifier_les_droits_sudo_pour_un_utilisateur&amp;diff=2315"/>
		<updated>2026-11-10T09:00:37Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Par défaut, les utilisateurs appartenant au groupe sudo ont tous les droits root. &amp;lt;u&amp;gt;Il est souvent conseillé de limiter les droits&amp;lt;/u&amp;gt; à quelques actions spécifiques nécessitant les droits root.&lt;br /&gt;
&lt;br /&gt;
* Editer le fichier &#039;&#039;&#039;&#039;&#039;/etc/sudoers&#039;&#039;&#039;&#039;&#039; et commenter la ligne :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# %sudo	ALL=(ALL:ALL) ALL&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Vérifier la configuration avec la commande :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
root@VLIN:~# visudo -c&lt;br /&gt;
/etc/sudoers : analyse réussie&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Créer &amp;amp; éditer un fichier dans &#039;&#039;&#039;&#039;&#039;/etc/sudoers.d/&amp;quot;Le User&amp;quot;&#039;&#039;&#039;&#039;&#039; qui contiendra la liste des commandes autorisées&lt;br /&gt;
** exemple ici &#039;&#039;(utilisateur à le droit de démarrer, arrêter, redémarrer et voir le statut du service &amp;quot;application&amp;quot;)&#039;&#039;.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
utilisateur ALL=(root) NOPASSWD: *** start application.service, /usr/bin/systemctl stop application.service, /usr/bin/systemctl restart application.service, /usr/bin/systemctl status application.service, /usr/bin/systemctl reset-failed application.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Attribuer les droits 0440 au fichier &#039;&#039;&amp;quot;Le User&amp;quot;&#039;&#039;&lt;br /&gt;
** &amp;lt;code&amp;gt;chmod 0440 /etc/sudoers.d/&amp;quot;Le User&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
* Contrôle de routine :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
root@VLIN:~# visudo -c&lt;br /&gt;
/etc/sudoers : analyse réussie&lt;br /&gt;
/etc/sudoers.d/Le User : analyse réussie&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Securite]]&lt;br /&gt;
[[Catégorie:Sudo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
[[Catégorie:Sudoers.d]]&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Sudo_:_Modifier_les_droits_sudo_pour_un_utilisateur&amp;diff=2314</id>
		<title>Sudo : Modifier les droits sudo pour un utilisateur</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Sudo_:_Modifier_les_droits_sudo_pour_un_utilisateur&amp;diff=2314"/>
		<updated>2026-11-10T09:00:19Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Par défaut, les utilisateurs appartenant au groupe sudo ont tous les droits root. &amp;lt;u&amp;gt;Il est souvent conseillé de limiter les droits&amp;lt;/u&amp;gt; à quelques actions spécifiques nécessitant les droits root.&lt;br /&gt;
&lt;br /&gt;
* Editer le fichier &#039;&#039;&#039;&#039;&#039;/etc/sudoers&#039;&#039;&#039;&#039;&#039; et commenter la ligne :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# %sudo	ALL=(ALL:ALL) ALL&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Vérifier la configuration avec la commande :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
root@VLIN:~# visudo -c&lt;br /&gt;
/etc/sudoers : analyse réussie&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Créer &amp;amp; éditer un fichier dans &#039;&#039;&#039;&#039;&#039;/etc/sudoers.d/&amp;quot;Le User&amp;quot;&#039;&#039;&#039;&#039;&#039; qui contiendra la liste des commandes autorisées&lt;br /&gt;
** exemple ici &#039;&#039;(utilisateur à le droit de démarrer, arrêter, redémarrer et voir le statut du service &amp;quot;application&amp;quot;)&#039;&#039;.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
utilisateur ALL=(root) NOPASSWD: *** start application.service, /usr/bin/systemctl stop application.service, /usr/bin/systemctl restart application.service, /usr/bin/systemctl status application.service, /usr/bin/systemctl reset-failed application.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Attribuer les droits 0440 au fichier &#039;&#039;&amp;quot;Le User&amp;quot;&#039;&#039;&lt;br /&gt;
** &amp;lt;code&amp;gt;chmod 0440 /etc/sudoers.d/&amp;quot;Le User&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
* Contrôle de routine :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
root@VLIN:~# visudo -c&lt;br /&gt;
/etc/sudoers : analyse réussie&lt;br /&gt;
/etc/sudoers.d/Le User : analyse réussie&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Securite]]&lt;br /&gt;
[[Catégorie:Sudo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Accueil&amp;diff=2313</id>
		<title>Accueil</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Accueil&amp;diff=2313"/>
		<updated>2026-11-09T15:03:24Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : /* Yakakliker */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Tutoriels ==&lt;br /&gt;
&lt;br /&gt;
* [[Installation &amp;amp; paramétrages de GLPI]]&lt;br /&gt;
* [[Installation de PhpMyFaq sur Ubuntu 22.04]]&lt;br /&gt;
* [[Installation de Mediawiki sur Ubuntu 22.04]]&lt;br /&gt;
* [[Installation de Smokeping]]&lt;br /&gt;
* [[Installation de Fail2ban]]&lt;br /&gt;
* [[Zerotier : Installation d&#039;un contrôleur]]&lt;br /&gt;
* [[Installation de Guacamole sur Ubuntu]]&lt;br /&gt;
* [[Gitlab : Installation]]&lt;br /&gt;
* [[Gluster : Procédure d&#039;installation Gluster sur un cluster Proxmox via une infrastructure VPN Zerotier]]&lt;br /&gt;
* [[Python : Création d&#039;un environnement virtuel Python / Gunicorn|Création d&#039;un environnement virtuel Python / Gunicorn]]&lt;br /&gt;
* [[Gluster : Création d&#039;un cluster Glusterfs|Création d&#039;un cluster Glusterfs]]&lt;br /&gt;
* [[Linux : Securiser un serveur Linux|Securiser un serveur Linux]]&lt;br /&gt;
* [[Tuto : Installation de Prometheus / Grafana|Installation de Prometheus / Grafana]]&lt;br /&gt;
* [[Python : Création d&#039;un environnement virtuel Python / Gunicorn|Création d&#039;un environnement virtuel Python / Gunicorn]]&lt;br /&gt;
* [[Python : Création d&#039;un repository python Devpi-server|Création d&#039;un repository python Devpi-server]]&amp;lt;br /&amp;gt;&lt;br /&gt;
== Catégories ==&lt;br /&gt;
&lt;br /&gt;
* [[:Catégorie:Apache2|Apache2]]&lt;br /&gt;
* [[:Catégorie:Scripts|Scripts]]&lt;br /&gt;
* [[:Catégorie:Fail2ban|Fail2ban]]&lt;br /&gt;
* [[:Catégorie:Crowdsec|Crowdsec]]&lt;br /&gt;
* [[:Catégorie:Securite|Securite]]&lt;br /&gt;
* [[:Catégorie:Linux|Linux]]&lt;br /&gt;
* [[:Catégorie:Proxmox|Proxmox]]&lt;br /&gt;
* [[:Catégorie:Haproxy|Haproxy]]&lt;br /&gt;
* [[:Catégorie:Zerotier|Zerotier]]&lt;br /&gt;
* [[:Catégorie:Mikrotik|Mikrotik]]&lt;br /&gt;
* [[:Catégorie:Opnsense|Opnsense]]&lt;br /&gt;
* [[:Catégorie:Ubuntu|Ubuntu]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Yakakliker ==&lt;br /&gt;
&lt;br /&gt;
* [https://openproject.yakakliker.org Openproject]&lt;br /&gt;
* [https://passbolt.yakakliker.org Passbolt]&lt;br /&gt;
* [[Spécial:Connexion|Connexion]]&lt;br /&gt;
&lt;br /&gt;
== Quelques liens ==&lt;br /&gt;
&lt;br /&gt;
* [https://docs.frrouting.org/en/latest/overview.html Frrouting.org]&lt;br /&gt;
* https://www.zerotier.com/&lt;br /&gt;
* https://www.proxmox.com/en/&lt;br /&gt;
* [https://help.mikrotik.com/docs/ Mikrotik]&lt;br /&gt;
* https://grisebouille.net/&lt;br /&gt;
* https://journaldunadminlinux.fr/&lt;br /&gt;
* [https://iplists.firehol.org/ Blacklistes]&lt;br /&gt;
* https://fouille-mot.fr/&lt;br /&gt;
* https://stat.ripe.net/&lt;br /&gt;
* https://jami.net/&lt;br /&gt;
* https://cyber.excusesecu.fr/&lt;br /&gt;
* https://standards-oui.ieee.org/&lt;br /&gt;
* https://www.submarinecablemap.com/&lt;br /&gt;
* https://bonjourlafuite.eu.org/&lt;br /&gt;
* https://christopheboutry.com/fuites-infos/&lt;br /&gt;
* https://matrix.org/&lt;br /&gt;
* https://saracroche.org/fr/&lt;br /&gt;
* https://filigrane.beta.gouv.fr/&lt;br /&gt;
* https://www.dossierfacile.logement.gouv.fr/&lt;br /&gt;
* https://pdoom-aujourdhui.vercel.app/&lt;br /&gt;
* https://www.europarl.europa.eu/news/fr&lt;br /&gt;
* https://www.ssllabs.com/ssltest/index.html&lt;br /&gt;
&lt;br /&gt;
== Veille Techno ==&lt;br /&gt;
&lt;br /&gt;
* [https://cyber.gouv.fr/publications/recommandations-sur-le-nomadisme-numerique Recommandations sur le nomadisme numérique]&lt;br /&gt;
* [https://cyber.gouv.fr/publications/recommandations-relatives-linterconnexion-dun-si-internet Recommandations relatives à l&#039;interconnexion d&#039;un SI à Internet]&lt;br /&gt;
* [https://cyber.gouv.fr/la-directive-nis-2 La directive NIS 2]&lt;br /&gt;
* https://www.cert.ssi.gouv.fr/&lt;br /&gt;
* [https://cyber.gouv.fr/en-cas-dincident Lien d&#039;urgence en cas d&#039;incident]&lt;br /&gt;
* [[Sécurité : Les attaques par déplacement latéral]]&lt;br /&gt;
* [https://www.globalsign.com/fr/blog/90-jour-a-47-evolution-duree-de-vie-certificats Sécurité : Evolution de la durée de vie des certificats]&lt;br /&gt;
* https://www.afnic.fr/observatoire-ressources/papier-expert/faire-heberger-son-courrier-electronique-avec-son-propre-nom-de-domaine/&lt;br /&gt;
&lt;br /&gt;
== News ==&lt;br /&gt;
&lt;br /&gt;
* https://www.lemondeinformatique.fr/publi_info/lire-alternatives-a-vmware-les-vertus-de-l-open-source-1068.html&lt;br /&gt;
* 16/04/2025 : https://www.datasecuritybreach.fr/coupure-brutale-dans-la-cybersecurite-la-base-cve-seteint/&lt;br /&gt;
* 19/11/2025 : [https://blog.cloudflare.com/fr-fr/18-november-2025-outage/ Panne géante Cloudflare, explications]&lt;br /&gt;
&lt;br /&gt;
== Alertes ==&lt;br /&gt;
&lt;br /&gt;
=== Mai 2026 ===&lt;br /&gt;
&lt;br /&gt;
* https://www.bortzmeyer.org/copyfail.html&lt;br /&gt;
* https://security-tracker.debian.org/tracker/CVE-2026-31431&lt;br /&gt;
* https://copy.fail/#copy-fail&lt;br /&gt;
* https://github.com/V4bel/dirtyfrag&lt;br /&gt;
* https://seclists.org/oss-sec/2026/q2/430&lt;br /&gt;
* https://www.bortzmeyer.org/dirtyfrag.html&lt;br /&gt;
&lt;br /&gt;
=== Septembre 2025 ===&lt;br /&gt;
&lt;br /&gt;
* https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-snmp-x4LPhte&lt;br /&gt;
&lt;br /&gt;
=== Juillet 2024 ===&lt;br /&gt;
&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/alerte/CERTFR-2024-ALE-009/ Vulnérabilité dans OpenSSH sur les version 8.5p1 à 9.7p1 (CVE-2024-6387)]&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/avis/CERTFR-2024-AVI-0533/ Multiples vulnérabilités dans Apache HTTP Server]&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/avis/CERTFR-2024-AVI-0561/ Nouvelles vulnérabilités détectées sur les produits Fortinet]&lt;br /&gt;
* https://www.cert.ssi.gouv.fr/avis/CERTFR-2025-AVI-0139/&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.abuseipdb.com/user/18731&amp;quot; title=&amp;quot;AbuseIPDB is an IP address blacklist for webmasters and sysadmins to report IP addresses engaging in abusive behavior on their networks&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;img src=&amp;quot;https://www.abuseipdb.com/contributor/18731.svg&amp;quot; alt=&amp;quot;AbuseIPDB Contributor Badge&amp;quot; style=&amp;quot;width: 401px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Accueil&amp;diff=2312</id>
		<title>Accueil</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Accueil&amp;diff=2312"/>
		<updated>2026-11-09T15:02:54Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : /* Yakakliker */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Tutoriels ==&lt;br /&gt;
&lt;br /&gt;
* [[Installation &amp;amp; paramétrages de GLPI]]&lt;br /&gt;
* [[Installation de PhpMyFaq sur Ubuntu 22.04]]&lt;br /&gt;
* [[Installation de Mediawiki sur Ubuntu 22.04]]&lt;br /&gt;
* [[Installation de Smokeping]]&lt;br /&gt;
* [[Installation de Fail2ban]]&lt;br /&gt;
* [[Zerotier : Installation d&#039;un contrôleur]]&lt;br /&gt;
* [[Installation de Guacamole sur Ubuntu]]&lt;br /&gt;
* [[Gitlab : Installation]]&lt;br /&gt;
* [[Gluster : Procédure d&#039;installation Gluster sur un cluster Proxmox via une infrastructure VPN Zerotier]]&lt;br /&gt;
* [[Python : Création d&#039;un environnement virtuel Python / Gunicorn|Création d&#039;un environnement virtuel Python / Gunicorn]]&lt;br /&gt;
* [[Gluster : Création d&#039;un cluster Glusterfs|Création d&#039;un cluster Glusterfs]]&lt;br /&gt;
* [[Linux : Securiser un serveur Linux|Securiser un serveur Linux]]&lt;br /&gt;
* [[Tuto : Installation de Prometheus / Grafana|Installation de Prometheus / Grafana]]&lt;br /&gt;
* [[Python : Création d&#039;un environnement virtuel Python / Gunicorn|Création d&#039;un environnement virtuel Python / Gunicorn]]&lt;br /&gt;
* [[Python : Création d&#039;un repository python Devpi-server|Création d&#039;un repository python Devpi-server]]&amp;lt;br /&amp;gt;&lt;br /&gt;
== Catégories ==&lt;br /&gt;
&lt;br /&gt;
* [[:Catégorie:Apache2|Apache2]]&lt;br /&gt;
* [[:Catégorie:Scripts|Scripts]]&lt;br /&gt;
* [[:Catégorie:Fail2ban|Fail2ban]]&lt;br /&gt;
* [[:Catégorie:Crowdsec|Crowdsec]]&lt;br /&gt;
* [[:Catégorie:Securite|Securite]]&lt;br /&gt;
* [[:Catégorie:Linux|Linux]]&lt;br /&gt;
* [[:Catégorie:Proxmox|Proxmox]]&lt;br /&gt;
* [[:Catégorie:Haproxy|Haproxy]]&lt;br /&gt;
* [[:Catégorie:Zerotier|Zerotier]]&lt;br /&gt;
* [[:Catégorie:Mikrotik|Mikrotik]]&lt;br /&gt;
* [[:Catégorie:Opnsense|Opnsense]]&lt;br /&gt;
* [[:Catégorie:Ubuntu|Ubuntu]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Yakakliker ==&lt;br /&gt;
&lt;br /&gt;
* [https://openproject.yakakliker.org Openproject]&lt;br /&gt;
* [https://passbolt.yakakliker.org Passbolt]&lt;br /&gt;
* [[Spécial:Connexion|Connexion]]&lt;br /&gt;
* [https://hetrixtools.com/report/uptime/cdac213e38c1692a64966ce91aa45206/ Monitoring]&lt;br /&gt;
&lt;br /&gt;
== Quelques liens ==&lt;br /&gt;
&lt;br /&gt;
* [https://docs.frrouting.org/en/latest/overview.html Frrouting.org]&lt;br /&gt;
* https://www.zerotier.com/&lt;br /&gt;
* https://www.proxmox.com/en/&lt;br /&gt;
* [https://help.mikrotik.com/docs/ Mikrotik]&lt;br /&gt;
* https://grisebouille.net/&lt;br /&gt;
* https://journaldunadminlinux.fr/&lt;br /&gt;
* [https://iplists.firehol.org/ Blacklistes]&lt;br /&gt;
* https://fouille-mot.fr/&lt;br /&gt;
* https://stat.ripe.net/&lt;br /&gt;
* https://jami.net/&lt;br /&gt;
* https://cyber.excusesecu.fr/&lt;br /&gt;
* https://standards-oui.ieee.org/&lt;br /&gt;
* https://www.submarinecablemap.com/&lt;br /&gt;
* https://bonjourlafuite.eu.org/&lt;br /&gt;
* https://christopheboutry.com/fuites-infos/&lt;br /&gt;
* https://matrix.org/&lt;br /&gt;
* https://saracroche.org/fr/&lt;br /&gt;
* https://filigrane.beta.gouv.fr/&lt;br /&gt;
* https://www.dossierfacile.logement.gouv.fr/&lt;br /&gt;
* https://pdoom-aujourdhui.vercel.app/&lt;br /&gt;
* https://www.europarl.europa.eu/news/fr&lt;br /&gt;
* https://www.ssllabs.com/ssltest/index.html&lt;br /&gt;
&lt;br /&gt;
== Veille Techno ==&lt;br /&gt;
&lt;br /&gt;
* [https://cyber.gouv.fr/publications/recommandations-sur-le-nomadisme-numerique Recommandations sur le nomadisme numérique]&lt;br /&gt;
* [https://cyber.gouv.fr/publications/recommandations-relatives-linterconnexion-dun-si-internet Recommandations relatives à l&#039;interconnexion d&#039;un SI à Internet]&lt;br /&gt;
* [https://cyber.gouv.fr/la-directive-nis-2 La directive NIS 2]&lt;br /&gt;
* https://www.cert.ssi.gouv.fr/&lt;br /&gt;
* [https://cyber.gouv.fr/en-cas-dincident Lien d&#039;urgence en cas d&#039;incident]&lt;br /&gt;
* [[Sécurité : Les attaques par déplacement latéral]]&lt;br /&gt;
* [https://www.globalsign.com/fr/blog/90-jour-a-47-evolution-duree-de-vie-certificats Sécurité : Evolution de la durée de vie des certificats]&lt;br /&gt;
* https://www.afnic.fr/observatoire-ressources/papier-expert/faire-heberger-son-courrier-electronique-avec-son-propre-nom-de-domaine/&lt;br /&gt;
&lt;br /&gt;
== News ==&lt;br /&gt;
&lt;br /&gt;
* https://www.lemondeinformatique.fr/publi_info/lire-alternatives-a-vmware-les-vertus-de-l-open-source-1068.html&lt;br /&gt;
* 16/04/2025 : https://www.datasecuritybreach.fr/coupure-brutale-dans-la-cybersecurite-la-base-cve-seteint/&lt;br /&gt;
* 19/11/2025 : [https://blog.cloudflare.com/fr-fr/18-november-2025-outage/ Panne géante Cloudflare, explications]&lt;br /&gt;
&lt;br /&gt;
== Alertes ==&lt;br /&gt;
&lt;br /&gt;
=== Mai 2026 ===&lt;br /&gt;
&lt;br /&gt;
* https://www.bortzmeyer.org/copyfail.html&lt;br /&gt;
* https://security-tracker.debian.org/tracker/CVE-2026-31431&lt;br /&gt;
* https://copy.fail/#copy-fail&lt;br /&gt;
* https://github.com/V4bel/dirtyfrag&lt;br /&gt;
* https://seclists.org/oss-sec/2026/q2/430&lt;br /&gt;
* https://www.bortzmeyer.org/dirtyfrag.html&lt;br /&gt;
&lt;br /&gt;
=== Septembre 2025 ===&lt;br /&gt;
&lt;br /&gt;
* https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-snmp-x4LPhte&lt;br /&gt;
&lt;br /&gt;
=== Juillet 2024 ===&lt;br /&gt;
&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/alerte/CERTFR-2024-ALE-009/ Vulnérabilité dans OpenSSH sur les version 8.5p1 à 9.7p1 (CVE-2024-6387)]&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/avis/CERTFR-2024-AVI-0533/ Multiples vulnérabilités dans Apache HTTP Server]&lt;br /&gt;
* [https://www.cert.ssi.gouv.fr/avis/CERTFR-2024-AVI-0561/ Nouvelles vulnérabilités détectées sur les produits Fortinet]&lt;br /&gt;
* https://www.cert.ssi.gouv.fr/avis/CERTFR-2025-AVI-0139/&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.abuseipdb.com/user/18731&amp;quot; title=&amp;quot;AbuseIPDB is an IP address blacklist for webmasters and sysadmins to report IP addresses engaging in abusive behavior on their networks&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;img src=&amp;quot;https://www.abuseipdb.com/contributor/18731.svg&amp;quot; alt=&amp;quot;AbuseIPDB Contributor Badge&amp;quot; style=&amp;quot;width: 401px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Thinlinc_:_Param%C3%A9trage_des_certificats&amp;diff=2311</id>
		<title>Thinlinc : Paramétrage des certificats</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Thinlinc_:_Param%C3%A9trage_des_certificats&amp;diff=2311"/>
		<updated>2026-11-09T14:08:05Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Emplacement des certificats dans Thinlinc ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/opt/thinlinc/etc/tlwebaccess&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Penser aux droits sur les certificats&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/opt/thinlinc/etc/tlwebaccess&lt;br /&gt;
[duderino@m tlwebaccess]$ sudo chmod 400 cert_wildcard.crt&lt;br /&gt;
[duderino@m tlwebaccess]$ sudo chmod 400 cert_wildcard.key&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;code&amp;gt;systemctl restart tlwebaccess&amp;lt;/code&amp;gt;&lt;br /&gt;
* cert.cert = certificat public&lt;br /&gt;
* cert.key = clé privée&lt;br /&gt;
&lt;br /&gt;
== Liens ==&lt;br /&gt;
https://community.thinlinc.com/t/thinlinc-web-access-ssl-tls-certificate/629/3&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
[[Catégorie:Thinlinc]]&lt;br /&gt;
[[Catégorie:Certificats]]&lt;br /&gt;
[[Catégorie:Let&#039;s Encrypt]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Thinlinc_:_Param%C3%A9trage_des_certificats&amp;diff=2310</id>
		<title>Thinlinc : Paramétrage des certificats</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Thinlinc_:_Param%C3%A9trage_des_certificats&amp;diff=2310"/>
		<updated>2026-11-09T14:07:11Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Emplacement des certificats dans Thinlinc ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/opt/thinlinc/etc/tlwebaccess&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Penser aux droits sur les certificats&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/opt/thinlinc/etc/tlwebaccess&lt;br /&gt;
[duderino@m tlwebaccess]$ sudo chmod 400 cert_wildcard.crt&lt;br /&gt;
[duderino@m tlwebaccess]$ sudo chmod 400 cert_wildcard.key&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;systemctl restart tlwebaccess&lt;br /&gt;
* cert.cert = certificat public&lt;br /&gt;
* cert.key = clé privée&lt;br /&gt;
&lt;br /&gt;
== Liens ==&lt;br /&gt;
https://community.thinlinc.com/t/thinlinc-web-access-ssl-tls-certificate/629/3&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
[[Catégorie:Thinlinc]]&lt;br /&gt;
[[Catégorie:Certificats]]&lt;br /&gt;
[[Catégorie:Let&#039;s Encrypt]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Thinlinc_:_Param%C3%A9trage_des_certificats&amp;diff=2309</id>
		<title>Thinlinc : Paramétrage des certificats</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Thinlinc_:_Param%C3%A9trage_des_certificats&amp;diff=2309"/>
		<updated>2026-11-09T14:06:29Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Emplacement des certificats dans Thinlinc ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/opt/thinlinc/etc/tlwebaccess&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Penser aux droits sur les certificats&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/opt/thinlinc/etc/tlwebaccess&lt;br /&gt;
[duderino@m tlwebaccess]$ sudo chmod 400 cert_wildcard.crt&lt;br /&gt;
[duderino@m tlwebaccess]$ sudo chmod 400 cert_wildcard.key&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* cert.cert = certificat public&lt;br /&gt;
* cert.key = clé privée&lt;br /&gt;
&lt;br /&gt;
== Liens ==&lt;br /&gt;
https://community.thinlinc.com/t/thinlinc-web-access-ssl-tls-certificate/629/3&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
[[Catégorie:Thinlinc]]&lt;br /&gt;
[[Catégorie:Certificats]]&lt;br /&gt;
[[Catégorie:Let&#039;s Encrypt]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2308</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2308"/>
		<updated>2026-11-06T09:09:18Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configurer et sécuriser le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
== Mise en place du point de montage ==&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2307</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2307"/>
		<updated>2026-11-06T09:08:45Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configurer et sécuriser le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
== Mise en place ==&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2306</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2306"/>
		<updated>2026-11-05T11:55:41Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configurer et sécuriser le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2305</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2305"/>
		<updated>2026-11-05T11:35:16Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configurer et sécuriser le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Discussion:Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2304</id>
		<title>Discussion:Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Discussion:Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2304"/>
		<updated>2026-11-05T10:55:34Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : Page vide créée&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2303</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2303"/>
		<updated>2026-11-05T10:54:12Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configurer le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2302</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2302"/>
		<updated>2026-11-05T10:53:18Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configure le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2301</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2301"/>
		<updated>2026-11-05T10:50:38Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas forcément monté en permanence pour diverses raisons.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configure le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2300</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2300"/>
		<updated>2026-11-05T10:49:54Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas monté en permanence.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
*&#039;&#039;&#039;&amp;lt;u&amp;gt;Avant d&#039;aller plus loin&amp;lt;/u&amp;gt;&#039;&#039;&#039;, faire un petit tour sur cette page afin de bien configure le montage : [[Linux : Créer un montage CIFS avec systemd]]&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2299</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2299"/>
		<updated>2026-11-05T10:46:52Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas monté en permanence.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 172.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2298</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2298"/>
		<updated>2026-11-05T10:43:27Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Montage réseau avec contrôle préalable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas monté en permanence.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
** &#039;&#039;&#039;Attente au démarrage :&#039;&#039;&#039; un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
** &#039;&#039;&#039;Surveillance continue :&#039;&#039;&#039; un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 17.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2297</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2297"/>
		<updated>2026-11-05T10:41:39Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* Montage réseau avec contrôle préalable&lt;br /&gt;
&lt;br /&gt;
Cette documentation décrit la mise en place d&#039;un montage réseau dont la destination n&#039;est pas toujours joignable, par exemple à travers un tunnel VPN qui n&#039;est pas monté en permanence.&lt;br /&gt;
&lt;br /&gt;
* Le mécanisme comporte deux volets :&lt;br /&gt;
&lt;br /&gt;
Attente au démarrage : un service vérifie par ping que l&#039;adresse IP de la destination répond, puis lance le montage. Il réessaie tant que la destination reste injoignable. Un cron redémarre ce service chaque jour à 6h.&lt;br /&gt;
&lt;br /&gt;
* Surveillance continue : un timer systemd contrôle toutes les 5 minutes que le point de montage est accessible. S&#039;il ne répond plus, il le démonte puis le remonte.&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 17.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2296</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2296"/>
		<updated>2026-11-05T10:38:35Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* L&#039;objectif de cette documentation est de mettre en place un service de montage réseau avec un contrôle préalable du lien de destination. Typiquement, pour permettre de faire un montage réseau à travers un tunnel VPN pas forcément monté en permanence .&lt;br /&gt;
* En plus du contrôle avant montage, un service va aussi surveiller la disponibilité du point de montage afin de relancer la connexion si besoin .&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 17.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2295</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2295"/>
		<updated>2026-11-05T10:36:51Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* L&#039;objectif de cette documentation est de créer un service de montage réseau avec un contrôle préalable du lien de destination. Typiquement, pour permettre de faire un montage réseau à travers un tunnel VPN pas forcément monté en permanence .&lt;br /&gt;
* En plus du contrôle avant montage, un service va aussi surveiller la disponibilité du point de montage afin de relancer la connexion si besoin .&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 17.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Cat%C3%A9gorie:Montage_reseau&amp;diff=2294</id>
		<title>Catégorie:Montage reseau</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Cat%C3%A9gorie:Montage_reseau&amp;diff=2294"/>
		<updated>2026-11-05T10:34:47Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : Page vide créée&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2293</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2293"/>
		<updated>2026-11-05T10:34:34Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* L&#039;objectif de cette documentation est de créer un service de montage réseau avec un contrôle préalable du lien de destination. Typiquement, pour permettre de faire un montage réseau à travers un tunnel VPN pas forcément monté en permanence .&lt;br /&gt;
* En plus du contrôle avant montage, un service va aussi surveiller la disponibilité du point de montage afin de relancer la connexion si besoin .&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 17.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Montage reseau]]&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2292</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2292"/>
		<updated>2026-11-05T10:33:44Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* L&#039;objectif de cette documentation est de créer un service de montage réseau avec un contrôle préalable du lien de destination. Typiquement, pour permettre de faire un montage réseau à travers un tunnel VPN pas forcément monté en permanence .&lt;br /&gt;
* En plus du contrôle avant montage, un service va aussi surveiller la disponibilité du point de montage afin de relancer la connexion si besoin .&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 17.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2291</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2291"/>
		<updated>2026-11-05T10:33:15Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
* L&#039;objectif de cette documentation est de créer un service de montage réseau avec un contrôle préalable du lien de destination. Typiquement, pour permettre de faire un montage réseau à travers un tunnel VPN pas forcément monté en permanence.&lt;br /&gt;
* En plus du contrôle avant montage, un service va aussi surveiller la disponibilité du point de montage afin de relancer la connexion si besoin.&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 17.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2290</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2290"/>
		<updated>2026-11-05T10:32:43Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Objectif ==&lt;br /&gt;
&lt;br /&gt;
* L&#039;objectif de cette documentation est de créer un service de montage réseau avec un contrôle préalable du lien de destination. Typiquement, pour permettre de faire un montage réseau à travers un tunnel VPN pas forcément monté en permanence.&lt;br /&gt;
* En plus du contrôle avant montage, un service va aussi surveiller la disponibilité du point de montage afin de relancer la connexion si besoin.&lt;br /&gt;
&lt;br /&gt;
=== Service systemctl pour le montage réseau ===&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ===&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ===&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 17.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de tout ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;une tâche cron pour un lancement quotidien du service ===&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2289</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2289"/>
		<updated>2026-11-05T10:31:48Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Objectif ==&lt;br /&gt;
&lt;br /&gt;
* L&#039;objectif de cette documentation est de créer un service de montage réseau avec un contrôle préalable du lien de destination. Typiquement, pour permettre de faire un montage réseau à travers un tunnel VPN pas forcément monté en permanence.&lt;br /&gt;
* En plus du contrôle avant montage, un service va aussi surveiller la disponibilité du point de montage afin de relancer la connexion si besoin.&lt;br /&gt;
&lt;br /&gt;
== Service systemctl pour le montage réseau ==&lt;br /&gt;
&lt;br /&gt;
* Le service se nommera : &#039;&#039;&#039;&#039;&#039;mnt-Montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//172.31.10.100/Montage&lt;br /&gt;
Where=/mnt/Montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-montage,uid=1000,gid=1000,file_mode=0444,dir_mode=0555,vers=2.1,ro,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script qui va permettre de tester l&#039;IP vers le NAS et lancer le montage dès réponse du ping ==&lt;br /&gt;
&lt;br /&gt;
* Le script va se nommer  : &#039;&#039;&#039;&#039;&#039;attendre-ip-puis-demarrer.sh&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Usage : attendre-ip-puis-demarrer.sh &amp;lt;IP&amp;gt; &amp;lt;unité&amp;gt; [intervalle en secondes]&lt;br /&gt;
&lt;br /&gt;
IP=&amp;quot;${1:-172.31.10.100}&amp;quot; # Adresse IP VPN du NAS à contrôler avant montage&lt;br /&gt;
SERVICE=&amp;quot;${2:-mnt-Montage.mount}&amp;quot; # Service de montage à lancer&lt;br /&gt;
INTERVALLE=&amp;quot;${3:-10}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log() { echo &amp;quot;$(date &#039;+%F %T&#039;) : $*&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if ping -c 1 -W 2 &amp;quot;$IP&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
        if systemctl is-active --quiet &amp;quot;$SERVICE&amp;quot;; then&lt;br /&gt;
            log &amp;quot;$SERVICE est actif, fin du script&amp;quot;&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        log &amp;quot;$IP repond, demarrage de $SERVICE&amp;quot;&lt;br /&gt;
        systemctl start &amp;quot;$SERVICE&amp;quot; || log &amp;quot;echec du demarrage de $SERVICE, nouvelle tentative&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log &amp;quot;$IP ne repond pas, nouvelle tentative dans ${INTERVALLE}s&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    sleep &amp;quot;$INTERVALLE&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Service qui va lancer le script &amp;quot;attendre-ip-puis-demarrer.sh&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
* Le service sera nommé : &#039;&#039;&#039;&#039;&#039;attendre-ip.service&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Attendre la reponse du VPN puis demarrer mnt-Montage.mount&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/attendre-ip-puis-demarrer.sh 17.31.10.100 mnt-Montage.mount 10&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=10&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installation de tout ce petit monde ==&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 attendre-ip-puis-demarrer.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now attendre-ip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u attendre-ip.service -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;une tâche cron pour un lancement quotidien du service ==&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
0 6 * * * /bin/systemctl restart attendre-ip.service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Pour détecter une coupure en cours de journée, il faut une vérification périodique. &lt;br /&gt;
&lt;br /&gt;
Le plus simple est un timer systemd qui relance le montage s&#039;il n&#039;est plus actif.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Création d&#039;un contrôle régulier du montage ==&lt;br /&gt;
&lt;br /&gt;
=== Création du script : &#039;&#039;&#039;&#039;&#039;verif-montage.sh&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
UNITE=&amp;quot;mnt-Montage.mount&amp;quot;&lt;br /&gt;
POINT=&amp;quot;/mnt/Montage&amp;quot;&lt;br /&gt;
TAG=&amp;quot;verif-montage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Test d&#039;accès réel au partage (lecture seule, borné à 5 secondes)&lt;br /&gt;
if mountpoint -q &amp;quot;$POINT&amp;quot; &amp;amp;&amp;amp; timeout 5 ls -A &amp;quot;$POINT&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
logger -t &amp;quot;$TAG&amp;quot; &amp;quot;$POINT inaccessible, relance de $UNITE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Démontage propre, avec démontage forcé en repli si le partage est bloqué&lt;br /&gt;
timeout 30 systemctl stop &amp;quot;$UNITE&amp;quot; 2&amp;gt;/dev/null || umount -l &amp;quot;$POINT&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
if ! systemctl start &amp;quot;$UNITE&amp;quot;; then&lt;br /&gt;
    logger -t &amp;quot;$TAG&amp;quot; &amp;quot;échec de la relance de $UNITE (partage probablement toujours injoignable)&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un service : &#039;&#039;&#039;&#039;&#039;verif-montage.service&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/verif-montage.sh	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création d&#039;un timer : &#039;&#039;&#039;&#039;&#039;verif-montage.timer&#039;&#039;&#039;&#039;&#039; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Verification periodique du montage Montage&lt;br /&gt;
&lt;br /&gt;
[Timer]&lt;br /&gt;
OnBootSec=2min&lt;br /&gt;
OnUnitActiveSec=5min&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=timers.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installation de ce petit monde ===&lt;br /&gt;
&amp;lt;code&amp;gt;sudo install -m 755 verif-montage.sh /usr/local/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable --now verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl list-timers verif-montage.timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -t verif-montage -f&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Le timer vérifie toutes les 5 minutes. Si le montage n&#039;est plus actif, il tente de le relancer. &lt;br /&gt;
&lt;br /&gt;
Quand l&#039;IP ne répond pas, la relance échoue, puis le timer réessaie à la prochaine itération.&lt;br /&gt;
&lt;br /&gt;
Pour tester sans attendre la coupure : lance &amp;lt;code&amp;gt;sudo systemctl start verif-montage.service&amp;lt;/code&amp;gt;, puis vérifie avec &amp;lt;code&amp;gt;journalctl -t verif-montage&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Si le partage est accessible, le script ne fait rien et ne journalise rien.&amp;lt;/blockquote&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2288</id>
		<title>Linux : Création d&#039;un service de montage réseau avec surveillance du lien</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9ation_d%27un_service_de_montage_r%C3%A9seau_avec_surveillance_du_lien&amp;diff=2288"/>
		<updated>2026-11-05T10:14:17Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : Page vide créée&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Fond_de_page&amp;diff=2287</id>
		<title>Fond de page</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Fond_de_page&amp;diff=2287"/>
		<updated>2026-10-29T07:37:31Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Fond_de_page&amp;diff=2286</id>
		<title>Fond de page</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Fond_de_page&amp;diff=2286"/>
		<updated>2026-10-29T07:37:04Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;https://www.cvefind.com/widget/iframe-widget.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
    IframeWidget.init(&#039;#iframeId&#039;, {&lt;br /&gt;
        baseUrl: &amp;quot;https://www.cvefind.com/widget/widget1.html&amp;quot;,&lt;br /&gt;
        api_key: &amp;quot;6ae2f6b844a69e671d0366e5&amp;quot;,&lt;br /&gt;
        params: {&lt;br /&gt;
            height: 190, [optional parameter: height iframe],&lt;br /&gt;
            bgcolor: &amp;quot;rgb(250,250,250)&amp;quot;, [optional parameter: background color],&lt;br /&gt;
            bgcoloritem: &amp;quot;rgb(255,255,255)&amp;quot;, [optional parameter: background color for item],&lt;br /&gt;
            score : &amp;quot;all&amp;quot;, [optional parameter: score CVE &amp;quot;all&amp;quot; or &amp;quot;high&amp;quot;],&lt;br /&gt;
            nb: 15, [optional parameter: number return CVE]&lt;br /&gt;
        }&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;iframe id=&amp;quot;iframeId&amp;quot; title=&amp;quot;Iframe CVE Find&amp;quot;&lt;br /&gt;
    frameborder=&amp;quot;no&amp;quot; allowtransparency=&amp;quot;true&amp;quot; allowfullscreen=&amp;quot;&amp;quot;&lt;br /&gt;
    style=&amp;quot;display: block; width: 1px; min-width: 100%; border:1px solid #eaeaea&amp;quot; scrolling=&amp;quot;no&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/iframe&amp;gt;&lt;br /&gt;
              &lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9er_un_montage_CIFS_avec_systemd&amp;diff=2285</id>
		<title>Linux : Créer un montage CIFS avec systemd</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9er_un_montage_CIFS_avec_systemd&amp;diff=2285"/>
		<updated>2026-10-26T10:20:52Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Créer un fichier de service systemd dans &#039;&#039;&#039;&#039;&#039;/etc/systemd/system/&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
** Attention ! Le fichier doit avoir un format bien spécifique :&lt;br /&gt;
*** &amp;quot;chemin du montage.mount&amp;quot;&lt;br /&gt;
*** exemple :&lt;br /&gt;
**** Pour un montage dans &#039;&#039;&#039;&#039;&#039;/mnt/montage&#039;&#039;&#039;&#039;&#039;, le fichier se nommera : &#039;&#039;&#039;&#039;&#039;mnt-montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
**** Cela implique donc de bannir définitivement les nommages de dossiers avec un &amp;quot;-&amp;quot;&lt;br /&gt;
* Contenu du fichier :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//IP/Partage&lt;br /&gt;
Where=/mnt/Partage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-user,uid=1000,gid=1000,file_mode=0777,dir_mode=0777,vers=2.1,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Pour éviter l&#039;affichage en clair du mot de passe dans le fichier .mount, nous allons faire un fichier &amp;quot;&#039;&#039;&#039;&#039;&#039;credentials-user&#039;&#039;&#039;&#039;&#039;&amp;quot; qui va contenir les informations d&#039;identification nécessaires à la connexion&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir -p /etc/samba&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/samba/credentials-user&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Contenu du fichier :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
username=User&lt;br /&gt;
password=Password&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Paramétrages des droits d&#039;accès&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown root:root /etc/samba/credentials-user&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chmod 600 /etc/samba/credentials-user&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On active le service et on le démarre :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable mnt-Partage.mount&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl start mnt-Partage.mount&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl status mnt-Partage.mount&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:CIFS]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Cifs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9er_un_montage_CIFS_avec_systemd&amp;diff=2284</id>
		<title>Linux : Créer un montage CIFS avec systemd</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9er_un_montage_CIFS_avec_systemd&amp;diff=2284"/>
		<updated>2026-10-26T10:20:04Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Créer un fichier de service systemd dans &#039;&#039;&#039;&#039;&#039;/etc/systemd/system/&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
** Attention ! Le fichier doit avoir un format bien spécifique :&lt;br /&gt;
*** &amp;quot;chemin du montage.mount&amp;quot;&lt;br /&gt;
*** exemple :&lt;br /&gt;
**** Pour un montage dans &#039;&#039;&#039;&#039;&#039;/mnt/montage&#039;&#039;&#039;&#039;&#039;, le fichier se nommera : &#039;&#039;&#039;&#039;&#039;mnt-montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
**** Cela implique donc de bannir définitivement les nommages de dossiers avec un &amp;quot;-&amp;quot;&lt;br /&gt;
* Contenu du fichier :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//IP/Partage&lt;br /&gt;
Where=/mnt/Partage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-user,uid=1000,gid=1000,file_mode=0777,dir_mode=0777,vers=2.1,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Pour éviter l&#039;affichage en clair du mot de passe dans le fichier .mount, nous allons faire un fichier &amp;quot;&#039;&#039;&#039;&#039;&#039;credentials-user&#039;&#039;&#039;&#039;&#039;&amp;quot; qui va contenir les informations d&#039;identification nécessaires à la connexion&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir -p /etc/samba&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/samba/credentials-user&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Contenu du fichier :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
username=User&lt;br /&gt;
password=Password&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Paramétrages des droits d&#039;accès&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown root:root /etc/samba/credentials-user&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chmod 600 /etc/samba/credentials-user&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On active le service et on le démarre :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable mnt-Partage.mount&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl start mnt-Partage.mount&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl status mnt-Partage.mount&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:CIFS]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Cifs]]&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9er_un_montage_CIFS_avec_systemd&amp;diff=2283</id>
		<title>Linux : Créer un montage CIFS avec systemd</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9er_un_montage_CIFS_avec_systemd&amp;diff=2283"/>
		<updated>2026-10-26T10:19:30Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Créer un fichier de service systemd dans &#039;&#039;&#039;&#039;&#039;/etc/systemd/system/&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
** Attention ! Le fichier doit avoir un format bien spécifique :&lt;br /&gt;
*** &amp;quot;chemin du montage.mount&amp;quot;&lt;br /&gt;
*** exemple :&lt;br /&gt;
**** Pour un montage dans &#039;&#039;&#039;&#039;&#039;/mnt/montage&#039;&#039;&#039;&#039;&#039;, le fichier se nommera : &#039;&#039;&#039;&#039;&#039;mnt-montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
**** Cela implique donc de bannir définitivement les nommages de dossiers avec un &amp;quot;-&amp;quot;&lt;br /&gt;
* Contenu du fichier :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//IP/Partage&lt;br /&gt;
Where=/mnt/Partage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-user,uid=1000,gid=1000,file_mode=0777,dir_mode=0777,vers=2.1,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Pour éviter l&#039;affichage en clair du mot de passe, nous allons faire un fichier &amp;quot;&#039;&#039;&#039;&#039;&#039;credentials-user&#039;&#039;&#039;&#039;&#039;&amp;quot; qui va contenir les informations d&#039;identification nécessaires à la connexion&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir -p /etc/samba&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/samba/credentials-user&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Contenu du fichier :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
username=User&lt;br /&gt;
password=Password&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Paramétrages des droits d&#039;accès&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown root:root /etc/samba/credentials-user&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chmod 600 /etc/samba/credentials-user&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On active le service et on le démarre :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable mnt-Partage.mount&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl start mnt-Partage.mount&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl status mnt-Partage.mount&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:CIFS]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Cifs]]&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Cat%C3%A9gorie:Cifs&amp;diff=2282</id>
		<title>Catégorie:Cifs</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Cat%C3%A9gorie:Cifs&amp;diff=2282"/>
		<updated>2026-10-26T10:19:03Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : Page vide créée&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9er_un_montage_CIFS_avec_systemd&amp;diff=2281</id>
		<title>Linux : Créer un montage CIFS avec systemd</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9er_un_montage_CIFS_avec_systemd&amp;diff=2281"/>
		<updated>2026-10-26T10:18:49Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Créer un fichier de service systemd dans &#039;&#039;&#039;&#039;&#039;/etc/systemd/system/&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
** Attention ! Le fichier doit avoir un format bien spécifique :&lt;br /&gt;
*** &amp;quot;chemin du montage.mount&amp;quot;&lt;br /&gt;
*** exemple :&lt;br /&gt;
**** Pour un montage dans &#039;&#039;&#039;&#039;&#039;/mnt/montage&#039;&#039;&#039;&#039;&#039;, le fichier se nommera : &#039;&#039;&#039;&#039;&#039;mnt-montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
**** Cela implique donc de bannir définitivement les nommages de dossiers avec un &amp;quot;-&amp;quot;&lt;br /&gt;
* Contenu du fichier :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
After=network-online.target&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//IP/Partage&lt;br /&gt;
Where=/mnt/Partage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=credentials=/etc/samba/credentials-user,uid=1000,gid=1000,file_mode=0777,dir_mode=0777,vers=2.1,_netdev&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Pour éviter l&#039;affichage en clair du mot de passe, nous allons faire un fichier &amp;quot;&#039;&#039;&#039;&#039;&#039;credientials-user&#039;&#039;&#039;&#039;&#039;&amp;quot; qui va contenir les informations d&#039;identification nécessaires à la connexion&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir -p /etc/samba&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/samba/credentials-user&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Contenu du fichier :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
username=User&lt;br /&gt;
password=Password&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Paramétrages des droits d&#039;accès&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown root:root /etc/samba/credentials-user&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chmod 600 /etc/samba/credentials-user&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On active le service et on le démarre :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable mnt-Partage.mount&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl start mnt-Partage.mount&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl status mnt-Partage.mount&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:CIFS]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:Cifs]]&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9er_un_montage_avec_un_service_systemd&amp;diff=2280</id>
		<title>Linux : Créer un montage avec un service systemd</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9er_un_montage_avec_un_service_systemd&amp;diff=2280"/>
		<updated>2026-10-26T10:18:28Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Créer un fichier de service systemd dans &#039;&#039;&#039;&#039;&#039;/etc/systemd/system/&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
** Attention ! Le fichier doit avoir un format bien spécifique :&lt;br /&gt;
*** &amp;quot;chemin du montage.mount&amp;quot;&lt;br /&gt;
*** exemple : &lt;br /&gt;
**** Pour un montage dans &#039;&#039;&#039;&#039;&#039;/mnt/montage&#039;&#039;&#039;&#039;&#039;, le fichier se nommera : &#039;&#039;&#039;&#039;&#039;mnt-montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
**** Cela implique donc de bannir définitivement les nommages de dossiers avec un &amp;quot;-&amp;quot;&lt;br /&gt;
* Contenu du fichier :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//Mon_IP/MonPartage&lt;br /&gt;
Where=/mnt/montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=username=user,password=MonPass,workgroup=home,rw,file_mode=0777,dir_mode=0777&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Reste à lancer le service :&lt;br /&gt;
** &amp;lt;code&amp;gt;systemctl start mnt-montage.mount&amp;lt;/code&amp;gt;&lt;br /&gt;
* Pour activer le service en automatique&lt;br /&gt;
** &amp;lt;code&amp;gt;systemctl enable mnt-montage.mount&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Créer un fichier mnt-montage.automount&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description= Auto Montage sur Partage NAS&lt;br /&gt;
&lt;br /&gt;
[Automount]&lt;br /&gt;
Where=/mnt/montage&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Reste à lancer le service :&lt;br /&gt;
** &amp;lt;code&amp;gt;systemctl start mnt-montage.automount&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Pour activer le service en automatique&lt;br /&gt;
** &amp;lt;code&amp;gt;systemctl enable mnt-montage.automount&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exemple avec un montage NFS ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage Nfs NAS&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=Serveur:/Partage&lt;br /&gt;
Where=/mnt/Partage&lt;br /&gt;
Type=nfs&lt;br /&gt;
Options=auto,nofail,noatime,nolock,intr&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Liens ===&lt;br /&gt;
https://antoinelounis.com/informatique/conseils/monter-dique-systemd/&lt;br /&gt;
&lt;br /&gt;
https://www.monlinux.net/2023/07/systemd-point-de-montage-cifs/&lt;br /&gt;
&lt;br /&gt;
https://anteru.net/blog/2019/automatic-mounts-using-systemd/&lt;br /&gt;
&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:CIFS]]&lt;br /&gt;
[[Catégorie:Cifs]]&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9er_un_montage_avec_un_service_systemd&amp;diff=2279</id>
		<title>Linux : Créer un montage avec un service systemd</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Linux_:_Cr%C3%A9er_un_montage_avec_un_service_systemd&amp;diff=2279"/>
		<updated>2026-10-26T10:18:10Z</updated>

		<summary type="html">&lt;p&gt;Administrateur : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Créer un fichier de service systemd dans &#039;&#039;&#039;&#039;&#039;/etc/systemd/system/&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
** Attention ! Le fichier doit avoir un format bien spécifique :&lt;br /&gt;
*** &amp;quot;chemin du montage.mount&amp;quot;&lt;br /&gt;
*** exemple : &lt;br /&gt;
**** Pour un montage dans &#039;&#039;&#039;&#039;&#039;/mnt/montage&#039;&#039;&#039;&#039;&#039;, le fichier se nommera : &#039;&#039;&#039;&#039;&#039;mnt-montage.mount&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
**** Cela implique donc de bannir définitivement les nommages de dossiers avec un &amp;quot;-&amp;quot;&lt;br /&gt;
* Contenu du fichier :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage NAS&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=//Mon_IP/MonPartage&lt;br /&gt;
Where=/mnt/montage&lt;br /&gt;
Type=cifs&lt;br /&gt;
Options=username=user,password=MonPass,workgroup=home,rw,file_mode=0777,dir_mode=0777&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Reste à lancer le service :&lt;br /&gt;
** &amp;lt;code&amp;gt;systemctl start mnt-montage.mount&amp;lt;/code&amp;gt;&lt;br /&gt;
* Pour activer le service en automatique&lt;br /&gt;
** &amp;lt;code&amp;gt;systemctl enable mnt-montage.mount&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Créer un fichier mnt-montage.automount&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description= Auto Montage sur Partage NAS&lt;br /&gt;
&lt;br /&gt;
[Automount]&lt;br /&gt;
Where=/mnt/montage&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;systemctl daemon-reload&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Reste à lancer le service :&lt;br /&gt;
** &amp;lt;code&amp;gt;systemctl start mnt-montage.automount&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Pour activer le service en automatique&lt;br /&gt;
** &amp;lt;code&amp;gt;systemctl enable mnt-montage.automount&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exemple avec un montage NFS ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Montage sur Partage Nfs NAS&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[Mount]&lt;br /&gt;
What=Serveur:/Partage&lt;br /&gt;
Where=/mnt/Partage&lt;br /&gt;
Type=nfs&lt;br /&gt;
Options=auto,nofail,noatime,nolock,intr&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Liens ===&lt;br /&gt;
https://antoinelounis.com/informatique/conseils/monter-dique-systemd/&lt;br /&gt;
&lt;br /&gt;
https://www.monlinux.net/2023/07/systemd-point-de-montage-cifs/&lt;br /&gt;
&lt;br /&gt;
https://anteru.net/blog/2019/automatic-mounts-using-systemd/&lt;br /&gt;
&lt;br /&gt;
[[Catégorie:Linux]]&lt;br /&gt;
[[Catégorie:Fstab]]&lt;br /&gt;
[[Catégorie:Systemd]]&lt;br /&gt;
&lt;br /&gt;
		‎&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://www.compteurdevisite.com&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx&amp;quot; border=&amp;quot;0&amp;quot; title=&amp;quot;compteur web gratuit sans pub&amp;quot; alt=&amp;quot;compteur web gratuit sans pub&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
‎		&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;https://storage.ko-fi.com/cdn/scripts/overlay-widget.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  kofiWidgetOverlay.draw(&#039;yakakliker&#039;, {&lt;br /&gt;
    &#039;type&#039;: &#039;floating-chat&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text&#039;: &#039;Café&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.background-color&#039;: &#039;#00b9fe&#039;,&lt;br /&gt;
    &#039;floating-chat.donateButton.text-color&#039;: &#039;#fff&#039;&lt;br /&gt;
  });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
		‎&amp;lt;/html&amp;gt;&lt;br /&gt;
[[Catégorie:Systemctl]]&lt;br /&gt;
[[Catégorie:CIFS]]&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
</feed>