Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
floss:config_ubuntu_server_rpi3 [2020/12/26 19:23] – villersd | floss:config_ubuntu_server_rpi3 [2024/04/16 09:34] (Version actuelle) – villersd | ||
---|---|---|---|
Ligne 7: | Ligne 7: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * janvier 2024 : The simplest way is to use the [[https:// | ||
+ | * [[https:// | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
* [[: | * [[: | ||
+ | * liens adaptés pour Ubuntu 22.04.3 : | ||
+ | * [[https:// | ||
===== Installation ===== | ===== Installation ===== | ||
Ligne 87: | Ligne 91: | ||
* Paquets additionnels (options) : | * Paquets additionnels (options) : | ||
* **sudo apt-get install unison** (FIXME : compatibilité avec 18.04) | * **sudo apt-get install unison** (FIXME : compatibilité avec 18.04) | ||
+ | |||
+ | ==== Ajustement de la timezone ==== | ||
+ | * réf : [[https:// | ||
+ | * ls -l / | ||
+ | * timedatectl | ||
+ | * sudo unlink / | ||
+ | * sudo ln -s / | ||
+ | * ls -l / | ||
+ | * timedatectl | ||
==== Installation type sur un serveur LA(M)P : DokuWiki ===== | ==== Installation type sur un serveur LA(M)P : DokuWiki ===== | ||
Ligne 129: | Ligne 142: | ||
* sudo apt-get upgrade | * sudo apt-get upgrade | ||
* sudo apt-get dist-upgrade | * sudo apt-get dist-upgrade | ||
+ | * [[https:// | ||
+ | * erreurs disques : enlever la carte mémoire, la placer dans un lecteur de carte microSD sur un autre ordinateur, et tenter la correction via ces deux commandes : | ||
+ | * < | ||
+ | * < | ||
Ligne 156: | Ligne 173: | ||
=== Script de sauvegarde === | === Script de sauvegarde === | ||
- | * → ajuster l' | + | * → ajuster l' |
* Backup sur l' | * Backup sur l' | ||
* Le script bash backup.sh doit être exécutable. Après sa création, il faudra exécuter "chmod +x backup.sh" | * Le script bash backup.sh doit être exécutable. Après sa création, il faudra exécuter "chmod +x backup.sh" | ||
Ligne 167: | Ligne 184: | ||
<code backup.sh> | <code backup.sh> | ||
- | #!/bin/sh | + | #!/bin/bash |
THESITE=" | THESITE=" | ||
THEDB=" | THEDB=" | ||
Ligne 178: | Ligne 195: | ||
#tar -czf ~/ | #tar -czf ~/ | ||
tar -czf / | tar -czf / | ||
- | # éliminer les fichier vieux de plus de 5 jours → À RETESTER !! | + | # éliminer les fichier vieux de plus de 5 jours |
- | #find / | + | find ~/ |
- | #find / | + | find ~/ |
</ | </ | ||
- | Version après élimination d' | + | Version après élimination d' |
<code backup.sh> | <code backup.sh> | ||
Ligne 193: | Ligne 210: | ||
</ | </ | ||
+ | Test du backup : | ||
+ | < | ||
+ | ./backup.sh | ||
+ | </ | ||
+ | |||
+ | Part of bash (version >=4.2) script to remove files in a given directory, older than 8 days, but leave files dated the first day of each month : | ||
+ | |||
+ | < | ||
+ | # Set the directory to clean up | ||
+ | DIR=" | ||
+ | |||
+ | # Calculate the cutoff date | ||
+ | CUTOFF=$(date -d "8 days ago" +%s) | ||
+ | |||
+ | # Loop through the files in the directory | ||
+ | for FILE in " | ||
+ | do | ||
+ | # Check if the file is older than 8 days | ||
+ | if [[ -f " | ||
+ | then | ||
+ | # Check if the file's date is the first day of the month | ||
+ | if [[ $(date -r " | ||
+ | then | ||
+ | echo " | ||
+ | else | ||
+ | echo " | ||
+ | rm " | ||
+ | fi | ||
+ | fi | ||
+ | done | ||
+ | |||
+ | </ | ||
+ | |||
+ | Here's how the script works: | ||
+ | - Set the DIR variable to the directory you want to clean up. | ||
+ | - Use the date command to calculate the cutoff date. This will be 8 days ago from today. | ||
+ | - Loop through each file in the directory using a for loop. | ||
+ | - Check if the file is a regular file (-f) and if its modification time is older than the cutoff date. If it is not, then skip to the next file. | ||
+ | - If the file's modification time is older than the cutoff date, check if the file's date is the first day of the month. If it is, then skip to the next file. | ||
+ | - If the file's date is not the first day of the month, then delete the file using the rm command. | ||
+ | |||
+ | Références sur les formats de date : | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | Références sur les scripts de backup | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||