Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
utilisateurs:draco31.fr:brouillon [Le 14/11/2010, 02:23]
draco31.fr
utilisateurs:draco31.fr:brouillon [Le 19/08/2012, 23:16] (Version actuelle)
draco31.fr
Ligne 1: Ligne 1:
-====== Ceci est ma page BROUILLON !! ======+====== ​∴☆★ ​Ceci est ma page BROUILLON !! ★☆∴ ​======
  
-===== Test box =====+===== NUT & upsmon & upssched ​=====
  
-==== Page imprimantes ​====+==== Monitorer les événements de l'UPS avec upsmon ​====
  
-  * v0 -- Version Frombenny, page imprimante :+=== Configuration par défaut ===
  
-<box 100% center #​FFFFFF><​box 100px round left #dcf0ea>**[[:​imprimantes_brother|Brother]]**</box> +Par défaut, toutes les types d’événements sont associés aux directives ​**SYSLOG** (écriture dans ''​/var/log/syslog''​) et **WALL** (notification aux utilisateurs par les terminaux). 
-<box 100px round left #​dcf0ea>​**[[:​tutoriel/installer_imprimante_canon|Canon]]**<​/box> +<note warning>FIXME Sous Ubuntu, la notification par la commande ​**''​wall''​** ne semble pas fonctionner !</note>
-<box 100px round left #dcf0ea>**[[:​tutoriel/​installer_imprimante_compaq|Compaq]]**</​box>​ +
-<box 100px round left #dcf0ea>**[[:​tutoriel/​installer_imprimante_dell| Dell]]**</box> +
-<box 100px round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_epson|Epson]]**</​box>​ +
-<box 100px round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_hp|HP]]**</​box>​ +
-<box 150px round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_konica|Konica/​Minolta]]**</​box>​ +
-<box 100px round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_lexmark|Lexmark]]**</​box>​ +
-<box 100px round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_ricoh|Ricoh]]**</​box>​ +
-<box 100px round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_samsung|Samsung]]**</​box>​ +
-<box 100px round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_xerox|Xerox]]**</​box></​box>+
  
-Texte ...+Le fichier **''/​etc/​nut/​upsmon''​** contient donc les lignes suivantes : 
 +<​file>​ 
 +NOTIFYFLAG ONLINE ​   SYSLOG+WALL 
 +NOTIFYFLAG ONBATT ​   SYSLOG+WALL 
 +NOTIFYFLAG LOWBATT ​  ​SYSLOG+WALL 
 +NOTIFYFLAG FSD       ​SYSLOG+WALL 
 +NOTIFYFLAG COMMOK ​   SYSLOG+WALL 
 +NOTIFYFLAG COMMBAD ​  ​SYSLOG+WALL 
 +NOTIFYFLAG SHUTDOWN ​ SYSLOG+WALL 
 +NOTIFYFLAG REPLBATT ​ SYSLOG+WALL 
 +NOTIFYFLAG NOCOMM ​   SYSLOG+WALL 
 +NOTIFYFLAG NOPARENT ​ SYSLOG+WALL 
 +</​file>​
  
-  ​v1 -Mini box 10 x 7% + 1 x 14%+Dans **''/​var/​log/​syslog''​**,​ on obtient un message préformaté. Exemple : 
 +<​file>​ 
 +Aug 19 21:49:34 localhost upsmon[7784]:​ Startup successful 
 +Aug 19 21:50:24 localhost upsmon[7786]:​ UPS localups@localhost on battery 
 +Aug 19 21:50:34 localhost upsmon[7786]:​ Poll UPS [localups@localhost] failed ​Data stale 
 +Aug 19 21:50:34 localhost upsmon[7786]:​ Communications with UPS localups@localhost lost 
 +Aug 19 21:50:39 localhost upsmon[7786]:​ Communications with UPS localups@localhost established 
 +Aug 19 21:50:39 localhost upsmon[7786]:​ UPS localups@localhost on line power 
 +</​file>​
  
-<​note>​Problème si fenêtre redimensionnée : texte tronqué !</​note>​+<​note>​//Dans l'​exemple ci-dessus ''​localups''​ est le libellé associé à l'​onduleur dans le fichier **''/​etc/​nut/​ups.conf''​**//​</​note>​
  
-<box 100% center #​FFFFFF>​ +=== Utilisation d'un script via l'​option NOTIFYCMD et la directive EXEC===
-<box 7% round left #​dcf0ea>​**[[:​imprimantes_brother|Brother]]**</​box>​ +
-<box 7% round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_canon|Canon]]**</​box>​ +
-<box 7% round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_compaq|Compaq]]**</​box>​ +
-<box 7% round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_dell| Dell]]**</​box>​ +
-<box 7% round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_epson|Epson]]**</​box>​ +
-<box 7% round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_hp|HP]]**</​box>​ +
-<box 14% round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_konica|Konica/​Minolta]]**</​box>​ +
-<box 7% round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_lexmark|Lexmark]]**</​box>​ +
-<box 7% round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_ricoh|Ricoh]]**</​box>​ +
-<box 7% round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_samsung|Samsung]]**</​box>​ +
-<box 7% round left #​dcf0ea>​**[[:​tutoriel/​installer_imprimante_xerox|Xerox]]**</​box>​ +
-</​box>​+
  
-Texte ...+Il est possible en plus ou la place des directives WALL et SYSLOG, d'​utiliser la directive **''​EXEC''​** pour lancer un script définit par l'​option **''​NOTIFYCMD''​** pour réaliser un traitement personnalisé.
  
-==== Attributs ====+Le fichier de configuration **''/​etc/​nut/​upsmon.conf''​** contiendra donc la ligne : 
 +<​file>​ 
 +NOTIFYCMD /​usr/​local/​bin/​upsalert.sh 
 +</​file>​ 
 +<note tip>Le chemin ''/​usr/​local/​bin/​upsalert.sh''​ est à remplacer par celui votre script !</​note>​
  
-  * v2.0 -- unité largeur+Les options NOTIFYFAG concernée par ce traitement personnalisée doivent avoir la directive EXECExemple pour ''​ONLINE''​ et ''​ONBATT''​ et ''​LOWBATT''​ : 
 +<​file>​ 
 +NOTIFYFLAG ONLINE ​   SYSLOG+WALL+EXEC 
 +NOTIFYFLAG ONBATT ​   SYSLOG+WALL+EXEC 
 +NOTIFYFLAG LOWBATT ​  ​SYSLOG+WALL+EXEC 
 +NOTIFYFLAG FSD       ​SYSLOG+WALL 
 +NOTIFYFLAG COMMOK ​   SYSLOG+WALL 
 +NOTIFYFLAG COMMBAD ​  ​SYSLOG+WALL 
 +NOTIFYFLAG SHUTDOWN ​ SYSLOG+WALL 
 +NOTIFYFLAG REPLBATT ​ SYSLOG+WALL 
 +NOTIFYFLAG NOCOMM ​   SYSLOG+WALL 
 +NOTIFYFLAG NOPARENT ​ SYSLOG+WALL 
 +</​file>​
  
-<box 100% center|par défaut>​ +FIXME Le script reçoit en argument le même libellé que ce qui est tracé dans ''​/var/log/syslog''​.
-<box round left>n/a</box> +
-<box round left>​abcdefghijklmnopqrstuvwxyz<​/box> +
-</​box>​+
  
-<box 100% center|**%** fixe - pourcentage>​ +== Notification par mail ==
-<box 10% round left>​10%</​box>​ +
-<box 10% round left>​abcdefghijklmnopqrstuvwxyz</​box>​ +
-</​box>​+
  
-<box 100% center|**px** fixe - pixel> +<note warning>Votre modem ainsi que vos équipements réseaux reliant ce dernier au PC hébergeant upsmon serveur (relié à l'​onduleur) et upsmon client (celui exécutant le script) doivent aussi être alimentés pour pouvoir envoyer le mail au moment opportun. Dans le cas contraire, vous risquez de ne recevoir le mail que lorsque le courant revient, voir de ne pas recevoir le mail du tout !!</note>
-<box 100px round left>​100px</​box>​ +
-<box 100px round left>​abcdefghijklmnopqrstuvwxyz</​box>​ +
-</box>+
  
-<box 100% center|**em** augmente avec le zoom de la page - emphase ?> +** Choix d'un MTA accessible en console ​**
-<box 10em round left>​10em</​box>​ +
-<box 10em round left>​abcdefghijklmnopqrstuvwxyz</​box>​ +
-</​box>​+
  
-<box 100% center|**em** augmente avec le zoom de la page - emphase ?> +Plusieurs MTA (mail transfert agent) accessible en console sont disponibles dans les dépôts. Parmi ceux-ci on notera : 
-<box 26em round left>​26em</​box>​ +  ​[[:ssmtp]] : Très simple d'​utilisation 
-<box 26em round left>​abcdefghijklmnopqrstuvwxyz</​box>​ +  ​[[:mutt]] : plus évolué que ''​ssmtp''​ et ligne de commande plus complexe 
-</​box>​+  ​[[:​postfix]] : le plus puissant, mais aussi plus compliqué à configurer !
  
-<box 100% center|**ex** augmente avec le zoom de la page - ??> +** Installation et configuration avec SSMTP **
-<box 10ex round left>​10ex</​box>​ +
-<box 10ex round left>​abcdefghijklmnopqrstuvwxyz</​box>​ +
-</​box>​+
  
-<box 100% center|**ex** augmente avec le zoom de la page ??> +Exemple avec ''​ssmtp''​ : 
-<box 26ex round left>​26ex</​box+  * [[:​tutoriel:​comment_installer_un_paquet|Installer le paquet]] ​**[[apt>​ssmtp]]** 
-<box 26ex round left>​abcdefghijklmnopqrstuvwxyz</​box>​ +  * [[:​tutoriel:​comment_modifier_un_fichier|Modifier ​le fichier]] **''/​etc/​ssmtp/​ssmtp.conf''​** suivant l'​exemple ci-dessous :<file
-</box+root=mon-adresse-email@mon-fai.fr 25 
-<box 100% center|**pt** fixe point ?> +mailhub=smtp.fai.fr 
-<box 100pt round left>10pt</box> +hostname=ubuntu-desktop 
-<box 100pt round left>​abcdefghijklmnopqrstuvwxyz</​box+FromLineOverride=YES 
-</box>+</file
 +  Depuis un [[:​terminal]],​ faites un essai avec la commande ci-dessous :<code>ssmtp <mon-adresse-email@mon-fai.fr></code>entrez le texte suivant :<code>From: mon-adresse-email@mon-fai.fr 
 +Subject: Test envoi mail avec ssmtp 
 +Test réussi ! Bravo ! 
 +</code>et enfin, appuyez sur la combinaison CTRL+D pour terminer la saisie et envoyer le mail.
  
-<box 100% center|**cm** fixe - centimètre>​ +** Création du script de notification mail **
-<box 10cm round left>​10cm</​box>​ +
-<box 10cm round left>​abcdefghijklmnopqrstuvwxyz</​box>​ +
-</​box>​+
  
-<box 100% center|**mm** fixe  ​millimètres+<note> A METTRE EN FORME --- Brouillon</​note> 
-<box 100mm round left>100mm</box> +Créer un fichier pour l'​entête avec une ligne From: ; To: ; Subject: : Ces données sont invariantes dans le message. 
-<box 100mm round left>abcdefghijklmnopqrstuvwxyz</box+Créer le script contenant les lignes : 
-</box>+<code>#!/bin/bash 
 +echo "​$@"​ | cat </​chemin/​fichier/​entête- | ssmtp <mon-adresse-mail@mon-fai.fr
 +</code>
  
-<box 100% center|**pi** fixe - pitch ?> +FIXME : Non testé : à vérifier si ça marche bien :p
-<box 10pi round left>​10pi</​box>​ +
-<box 10pi round left>​abcdefghijklmnopqrstuvwxyz</​box>​ +
-</​box>​+
  
-<box 100% center|**in** fixe - inch+<note tips>Vous pouvez modifier le libellé par défaut associé à chaque événement dans le fichier upsmon.conf : 
-<box 10in round left>​10in</​box+<file
-<box 10in round left>​abcdefghijklmnopqrstuvwxyz</box> +NOTIFYMSG ONLINE "​UPS %s sur secteur."​ 
-</box>+NOTIFYMSG ONBATT "​UPS %s sur batterie."​ 
 +NOTIFYMSG LOWBATT "​UPS %s batterie faible."​ 
 +NOTIFYMSG FSD "​UPS %s: arrêt forcé en cours."​ 
 +NOTIFYMSG COMMOK "​Communications avec l'UPS %s établie."​ 
 +NOTIFYMSG COMMBAD "​Communications avec l'UPS %s perdue."​ 
 +NOTIFYMSG SHUTDOWN "​Déconnexion et arrêt automatiques engagés."​ 
 +NOTIFYMSG REPLBATT "​UPS %s La batterie doit être remplacée."​ 
 +NOTIFYMSG NOCOMM "​UPS %s indisponible."​ 
 +NOTIFYMSG NOPARENT "​mort du processus upsmon parent - arrêt impossible"​ 
 +</file></note>
  
-<box 100% center|**auto** paramètre inconnu - idem 50%> +=== Utilisation de upssched ===
-<box auto round left>​auto</​box>​ +
-<box auto round left>​abcdefghijklmnopqrstuvwxyz</​box>​ +
-</​box>​+
  
-  * v2.0 -- Taille suivant texte :+Si vous souhaitez effectuer des actions différentes selon le type d'​événement,​ il est préférable d'​utiliser upssched.
  
-<box 100% center|100% -- Titre> +fichier upsmon.conf (exemple) :
-<box 10% round left|10%></​box>​ +
-<box 10% round left|abcdefghijklmnopqrstuvwxyz></​box>​ +
-</​box>​+
  
-<box 100% center|100% -- Texte+<file
-<box 10% round left>​10%<​/box> +NOTIFYCMD ​/sbin/upssched
-<box 10% round left>​abcdefghijklmnopqrstuvwxyz<​/box> +
-</​box>​+
  
-<box 100% center|100% -- Légende>​ +NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC 
-<box 10% round left></​box|10%>​ +NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC 
-<box 10% round left></​box|abcdefghijklmnopqrstuvwxyz>​ +NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC 
-</box>+NOTIFYFLAG FSD SYSLOG+WALL+EXEC 
 +NOTIFYFLAG COMMOK SYSLOG+EXEC 
 +NOTIFYFLAG COMMBAD SYSLOG+EXEC 
 +NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC 
 +NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC 
 +NOTIFYFLAG NOCOMM SYSLOG+WALL+EXEC 
 +NOTIFYFLAG NOPARENT SYSLOG+WALL+EXEC 
 +</file>
  
-  * v2.1 -- Mini Box 50% seules+Créer le fichier de config /​etc/​nut/​upssched.conf 
 +<​file>​ 
 +# the script to be executed 
 +CMDSCRIPT /​usr/​local/​bin/​upsalert.sh
  
-<box 50% round left>​50%<​/box> +# mandatory fields that must be set before AT commands 
-<box 50% round left>​50%<​/box>+PIPEFN ​/var/​run/​nut/​upssched.pipe 
 +LOCKFN /​var/​run/​nut/upssched.lock
  
-\\ \\ \\ \\ \\ \\ +# the timers, here 30 sec after the ONBATT (ups on battery) event 
 +AT ONBATT * START-TIMER onbatt-timer 120
  
-  ​v2.2 -- Mini Box xx% dans box 100%+# cancel the countdown is power is back 
 +AT ONLINE ​CANCEL-TIMER onbatt-timer
  
-<box 100% center|100%>​ +AT COMMBAD * EXECUTE commbad 
-<box 50% round left>​50%</​box>​ +AT COMMOK * EXECUTE commok 
-<box 50% round left>​50%</​box>​ +AT NOCOMM * EXECUTE nocomm 
-</box>+AT ONBATT * EXECUTE onbatt 
 +AT LOWBATT * EXECUTE lowbatt 
 +AT ONLINE * EXECUTE online 
 +AT FSD * EXECUTE fsd 
 +AT SHUTDOWN * EXECUTE shutdown 
 +AT REPLBATT * EXECUTE replbatt 
 +AT NOPARENT * EXECUTE noparent 
 +</file>
  
-<box 100% center|100%+Créer le script /​usr/​local/​bin/​upsalert.sh (FIXME exemple à revoir) 
-<box 40% round left>​40%<​/box> +<file
-<box 40% round left>​40%<​/box> +#!/bin/bash 
-<box 40round left>40%</​box>​ +logfile=/​var/log/ups.log 
-</​box>​+date=$(date +"%%T")
  
-<box 100center|100%> +case $1 in 
-<box 30round left>30%</box+    commbad) 
-<box 30round left>30%</box+        echo "$date : UPS communications failure."​ >> $logfile 
-<box 30round left>30%</box+        ;; 
-<box 30round left>30%</box+    commok) 
-</box>+        echo "$date : UPS communications restored."​ >> $logfile 
 +        echo "$date :     ​Current status=[$(/​bin/​upsc localups ups.status)],​ Charge=$(/​bin/​upsc localups battery.charge)%, Load=$(/​bin/​upsc localups ups.load)%." ​>> $logfile 
 +        sudo /bin/upscmd -u login -p pwd localups beeper.enable 2>> $logfile 
 +        ;; 
 +    nocomm) 
 +        echo "$date : UPS communications cannot be established."​ >> $logfile 
 +        ;; 
 +    onbatt) 
 +        echo "$date : UPS is on battery. Trying to suspend."​ >> $logfile 
 +        echo "$date :     ​Current status=[$(/​bin/​upsc localups ups.status)],​ Charge=$(/​bin/​upsc localups battery.charge)%, Load=$(/​bin/​upsc localups ups.load)%." ​>> $logfile 
 +        sudo /bin/upscmd -u login -p pwd localups beeper.mute 120 2>> $logfile 
 +        sudo /​usr/​sbin/​pm-suspend-hybrid --quirk-none 2>&1 >> $logfile 
 +        ;; 
 +    onbatt-timer) 
 +        echo "$date : UPS is on battery for more than 2 min. Trying to hibernate."​ >> $logfile 
 +       $echo "$date :     ​Current status=[$(/​bin/​upsc localups ups.status)],​ Charge=$(/​bin/​upsc localups battery.charge)%, Load=$(/bin/upsc localups ups.load)%."​ >$logfile 
 +        sudo /bin/upscmd -u login -p pwd localups beeper.mute 300 2>> $logfile 
 +        sudo /​usr/​sbin/​pm-hibernate --quirk-none 2&>1 >>​$logfile 
 +        ;; 
 +    lowbatt) 
 +        echo "$date : UPS has a low battery. Current load=$(/​bin/​upsc localups ups.status)%. Trying forced-shutdown." ​>> $logfile 
 +        echo "$date :     ​Current status=[$(/​bin/​upsc localups ups.status)],​ Charge=$(/​bin/​upsc localups battery.charge)%, Load=$(/bin/upsc localups ups.load)%." ​>> $logfile 
 +        sleep 1 
 + sudo /bin/upscmd -u login -p pwd localups beeper.enable 2>> $logfile 
 +        sudo /​sbin/​upsmon -c fsd 2>&1 >> $logfile 
 +        ;; 
 +    online) 
 +        echo "$date : UPS on line. Shutdown aborted."​ >> $logfile 
 +        echo "$date :     ​Current status=[$(/​bin/​upsc localups ups.status)],​ Charge=$(/​bin/​upsc localups battery.charge)%, Load=$(/​bin/​upsc localups ups.load)%." ​>> $logfile 
 +        sudo /bin/upscmd -u login -p pwd localups shutdown.stop 
 +        sleep 1 
 +        sudo /​sbin/​upsmon -K && echo "$date : WARN : fsd flag is still on !" >> $logfile 
 +        sudo /bin/upscmd -u login -p pwd localups beeper.enable 2>​$logfile 
 +        ;; 
 +    fsd) 
 +        echo "$date : UPS is being forced-shutdown by the master."​ >> $logfile 
 +        echo "$date :     ​Current status=[$(/​bin/​upsc localups ups.status)],​ Charge=$(/​bin/​upsc localups battery.charge)%, Load=$(/bin/upsc localups ups.load)%." ​>> $logfile 
 +        sleep 1 
 +        sudo /bin/upscmd -u login -p pwd localups beeper.mute 300 2>> $logfile 
 +        ;; 
 +    shutdown) 
 +        echo "$date : The system is being shutdown."​ >> $logfile 
 +        echo "$date :     ​Current status=[$(/​bin/​upsc localups ups.status)],​ Charge=$(/​bin/​upsc localups battery.charge)%,​ Load=$(/​bin/​upsc localups ups.load)%." ​>> $logfile 
 +        sudo /bin/upscmd -u login -p pwd localups beeper.mute 300 2>> $logfile 
 +        ;; 
 +    replbatt) 
 +        echo "$date : UPS battery is bad and needs to be replaced !!!" >> $logfile 
 +        echo "$date :     ​Current status=[$(/​bin/​upsc localups ups.status)],​ Charge=$(/​bin/​upsc localups battery.charge)%, Load=$(/bin/upsc localups ups.load)%." ​>> $logfile 
 +        sudo /bin/upscmd -u login -p pwd localups beeper.enable 2>> $logfile 
 +        ;; 
 +    noparent) 
 +        echo "$date : The process that shuts down the system has died (shutdown impossible)."​ >> $logfile 
 +        sudo /​sbin/​shutdown -h now 2>&1 >> $logfile 
 +        ;; 
 +    *) 
 +        echo "$date : $0 > Unrecognized command: $1" | tee -a $logfile 1>&​2 
 +        echo "$date :     ​Current status=[$(/​bin/​upsc localups ups.status)],​ Charge=$(/​bin/​upsc localups battery.charge)%,​ Load=$(/​bin/​upsc localups ups.load)%."​ >> $logfile 
 +        ;; 
 +esac 
 +exit 0 
 +</file>
  
-<box 100% center|100%>​ +====== Réduire le nombre d'​écriture sur disque pour les log et sauver la vie du SSD Ryan ======
-<box 25% round left>​25%</​box>​ +
-<box 25% round left>​25%</​box>​ +
-<box 25% round left>​25%</​box>​ +
-<box 25% round left>​25%</​box>​ +
-</​box>​+
  
-==== Modulation sur box 25% ====+  - Créer un dossier pour les log permanentes : sudo mkdir -p /​var/​log.hdd/​ 
 +  - Modifier le fichier de config de /​etc/​logrotate.conf et ajouter la ligne ''​olddir /​var/​log.hdd/''​ : 
 +<​file>​ 
 +# see "man logrotate"​ for details 
 +# rotate log files weekly 
 +weekly
  
------+# keep 4 weeks worth of backlogs 
 +rotate 4
  
-<box 100% right|100% right> +# create new (empty) log files after rotating old ones 
-<box 25% round left>25% round left</​box>​ +create
-<box 25% round left>25% round left</​box>​ +
-<box 25% round left>25% round left</​box>​ +
-<box 25% round left>25% round left</​box>​ +
-</​box>​+
  
-<box 100% center|100% center> +# uncomment this if you want your log files compressed 
-<box 25% round left>25% round left</​box>​ +#compress
-<box 25% round left>25% round left</​box>​ +
-<box 25% round left>25% round left</​box>​ +
-<box 25% round left>25% round left</​box>​ +
-</​box>​+
  
-<box 100% left|100% left> +olddir ​/var/log.hdd/
-<box 25% round left>25% round left</box> +
-<box 25% round left>25% round left</box> +
-<box 25% round left>25% round left</box> +
-<box 25% round left>25% round left</​box>​ +
-</​box>​+
  
-<box 100% round left|100% round left> +# packages drop log rotation information into this directory 
-<box 25% round left>25% round left</box> +include ​/etc/logrotate.d
-<box 25% round left>25% round left</​box>​ +
-<box 25% round left>25% round left</​box>​ +
-<box 25% round left>25% round left</​box>​ +
-</box>+
  
-<box 100% left|100% left> +# no packages own wtmp, or btmp -- we'll rotate them here 
-<box 25% left>25% left</box> +/var/log/wtmp { 
-<box 25% left>25% left</box> +    ​missingok 
-<box 25% left>25% left</box> +    ​monthly 
-<box 25% left>25% left</​box>​ +    create 0664 root utmp 
-</​box>​+    rotate 1 
 +}
  
-<box 100% left> +/​var/​log/​btmp { 
-------- +    ​missingok 
-</​box>​+    ​monthly 
 +    create 0660 root utmp 
 +    rotate 1 
 +}
  
-%% +# system-specific logs may be configured here 
-<box 75% left|75% left+</file
-<box 25% left>25% left</box> +  - Modifier ​/etc/fstab pour charge /var/log sur un tmpfs : 
-<box 25% left>25% left</box> +<file> 
-<box 25% left>25% left</box> +# dossier en RAM (volatile) 
-<box 25% left>25% left</box> +tmpfs /tmp            tmpfs ​  ​defaults ​          ​ 0 ​   0 
-</box> +tmpfs      /var/​tmp ​     tmpfs ​  ​defaults ​   0 ​     0 
-%%+tmpfs      /var/​lock ​     tmpfs ​  ​defaults ​   0 ​     0 
 +tmpfs /​var/​log tmpfs defaults 0 0 
 +</file>
  
-<box 100% left> +<note important>Il est possible de s'​arrêter là, si le système est rarement rebooté, et que l'on accepte de perdre les logs depuis la dernière rotation</note>
-------- +
-</box>+
  
 +=== Mod easy ===
  
 +<note tip>​FIXME devrait bien marcher pour systèmes avec peu de reboot, et permet de ne perdre aucun log !!</​note>​
  
-<box 100% left|100% left> +  - FIXME Créer un script dans /​etc/​init.d/​ qui appele logrotate en mode forcé pour recopier les log dans /var/log.hdd si appelé avec ''​stop''​ 
-<box 25% round left>25% round left</box> +<code>#!/bin/sh 
-<box 25% round left>25% round left</box> +case "​$1"​ in 
-<box 25% round left>25% round left</box> +stop) 
-<box 25% round left>25% round left</box+logrotate -f /etc/logrotate.conf 
-</box>+;; 
 +*) 
 +#no-op 
 +;; 
 +esac 
 +exit 0 
 +</code
 +  - Lier le script dans /etc/​rc0.d/​S39savelogs
  
-==== Taille N box horizontales ====+> Le mieux serait de faire un service qui écoute le bon événement et ferait la manip juste avant le démontage (S40umountfs).
  
-<​note>​Valeurs pour résolution 1680x1050\\ Si fenêtre redimensionnée, ​ne fonctionne plus !</​note>​+<​note ​warning>Cela ne respecte pas les règles logrotate (daily, weekly ...) donc risque de perdre rapidement des données si peu de génération sont conservées pour un fichier donné ​!</​note>​
  
-  ​1 box horizontale+=== Mod avancé === 
 +  - FIXME Créer un script dans /etc/init.d qui fait : 
 +    ​en stop : copie des fichiers de /var/log vers /​var/​log.hdd && umount de /var/log && création des liens symboliques avec le même nom que les fichiers copiés de /var/log vers /​var/​log.hdd (ou lien symbolique des dossiers directement) FIXME utiliser le contenu de /​var/​lib/​logrotate/​status ? (cf. /​etc/​cron.daily/​logrotate ) 
 +    * en start (juste après mount), copier les log de /var/log/ à la suite des fichiers existant puis écrasement des fichiers de /var/log/ par ceux de /​var/​log.hdd
  
-<box 100% center|100% center> +<note warning>FIXME besoin de créer ​liens symbolique différents : nécessité de tester le nom d'​appel pour vérifier si Start ou Stop && avant/après mount/umount. start + après mount = OK ; stop + avant umount = OK ; sinon ne rien faire.</note>
-<box 100% round left>​100% left</​box>​ +
-</​box>​ +
- +
-  * box horizontales +
- +
-<box 100% center|100% center>​ +
-<box 48% round left>48% left</box> +
-<box 48% round left>48% left</box> +
-</box> +
- +
-<box 100% center|100% center>​ +
-<box 48% round center>​48% center</​box>​ +
-<box 48% round center>​48% center</​box>​ +
-</​box>​ +
- +
-<box 100% center|100% center>​ +
-<box 48% round right>​48% right</​box>​ +
-<box 48% round right>​48% right</​box>​ +
-</​box>​ +
- +
-<box 100% center|100% center>​ +
-<box 48% round left>48% left</​box>​ +
-<box 48% round right>​48% right</​box>​ +
-</​box>​ +
- +
-  * 3 box horizontales +
- +
-<box 100% center|100% center>​ +
-<box 32% round left>32% left</​box>​ +
-<box 32% round left>32% left</​box>​ +
-<box 32% round left>32% left</​box>​ +
-</​box>​ +
- +
-<box 100% center|100% center>​ +
-<box 32% round center>​32% center</​box>​ +
-<box 32% round center>​32% center</​box>​ +
-<box 32% round center>​32% center</​box>​ +
-</​box>​ +
- +
-<box 100% center|100% center>​ +
-<box 32% round right>​32% right</​box>​ +
-<box 32% round right>​32% right</​box>​ +
-<box 32% round right>​32% right</​box>​ +
-</​box>​ +
- +
-<box 100% center|100% center>​ +
-<box 32% round left>32% left **1**</​box>​ +
-<box 32% round right>​32% right **2**</​box>​ +
-<box 32% round center>​32% center **3**</​box>​ +
-</​box>​ +
- +
-  * 4 box horizontales +
- +
-<box 100% center|100% center>​ +
-<box 23% round left>23% left 1</​box>​ +
-<box 23% round left>23% left 2</​box>​ +
-<box 23% round left>23% left 3</​box>​ +
-<box 23% round left>23% left 4</​box>​ +
-</​box>​ +
- +
-<box 100% center|100% center>​ +
-<box 23% round left>23% left 1</​box>​ +
-<box 23% round left>23% left 2</​box>​ +
-<box 23% round right>​23% right 3</​box>​ +
-<box 23% round right>​23% right 4</​box>​ +
-</​box>​ +
- +
-<box 100% center|100% center>​ +
-<box 23% round left>23% left 1</​box>​ +
-<box 23% round right>​23% right 2</​box>​ +
-<box 23% round center>​23% center 3</​box>​ +
-<box 23% round center>​23% center 4</​box>​ +
-</​box>​ +
- +
- +
- +
-Texte ...+
  • utilisateurs/draco31.fr/brouillon.1289697818.txt.gz
  • Dernière modification: Le 18/04/2011, 14:44
  • (modification externe)