Amélioration de la liste des fichiers MD
This commit is contained in:
parent
c7cf651727
commit
3a2952a81f
22
FILES.md
22
FILES.md
|
@ -1,9 +1,13 @@
|
|||
- [./code_of_conduct.md](./code_of_conduct.md)
|
||||
- [./contribute.md](./contribute.md)
|
||||
- [./notes/certificats/creer_une_autorite_de_certification_CA_privee.md](./notes/certificats/creer_une_autorite_de_certification_CA_privee.md)
|
||||
- [./notes/serveur/fail2ban.md](./notes/serveur/fail2ban.md)
|
||||
- [./notes/serveur/fail2ban-postfix-sasl.md](./notes/serveur/fail2ban-postfix-sasl.md)
|
||||
- [./notes/serveur/fail2ban-sshd.md](./notes/serveur/fail2ban-sshd.md)
|
||||
- [./notes/serveur/postfix-delete-messages-deferred.md](./notes/serveur/postfix-delete-messages-deferred.md)
|
||||
- [./notes/webapps/clamav-avec-nextcloud.md](./notes/webapps/clamav-avec-nextcloud.md)
|
||||
- [./FILES.md](./FILES.md)
|
||||
# Liste des fichiers Markdown
|
||||
- [Code de Conduite du Contributeur](./code_of_conduct.md)
|
||||
- [Contribuer au Projet](./contribute.md)
|
||||
- **Certificats**
|
||||
- [Créer une autorité de certification (CA) privée](./notes/certificats/creer_une_autorite_de_certification_CA_privee.md)
|
||||
- **Serveur**
|
||||
- [Sécuriser avec fail2ban](./notes/serveur/fail2ban.md)
|
||||
- [Sécuriser Postfix avec fail2ban](./notes/serveur/fail2ban-postfix-sasl.md)
|
||||
- [Sécuriser sshd avec fail2ban](./notes/serveur/fail2ban-sshd.md)
|
||||
- [Automatisation de la Gestion des Messages Différés de Postfix](./notes/serveur/postfix-delete-messages-deferred.md)
|
||||
- **Webapps**
|
||||
- [Rendre accessible Clamav à NextCloud](./notes/webapps/clamav-avec-nextcloud.md)
|
||||
- [Notes Techniques](./README.md)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Sécuriser Postfix avec fail2ban
|
||||
# Sécuriser sshd avec fail2ban
|
||||
|
||||
Cédrix - 2024-07-24
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Sécuriser Postfix avec fail2ban
|
||||
# Sécuriser avec fail2ban
|
||||
|
||||
Cédrix - 2024-07-24
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Automatisation de la Gestion des Messages Différés de Postfix avec un Script PHP
|
||||
# Automatisation de la Gestion des Messages Différés de Postfix
|
||||
|
||||
L'objectif du script PHP [delete_deferred.php](_files/postfix/home/cedrix/delete_deferred.php) est de gérer automatiquement les messages de courrier électronique en attente dans la file d'attente de Postfix, spécifiquement ceux avec un statut `deferred` dans `/var/log/mail.log`. Le script identifie ces messages, les supprime de la file d'attente et garde une trace des messages dans déjà traités `/var/log/processed_ids_deferred.txt` pour éviter les traitements redondants.
|
||||
|
||||
|
|
|
@ -6,23 +6,46 @@ README="FILES.md"
|
|||
TEMP_FILE=$(mktemp)
|
||||
|
||||
# Get all .md files in the repository except the README.md
|
||||
find . -type f -name "*.md" ! -name "README.md" | sort > "$TEMP_FILE"
|
||||
find . -type f -name "*.md" ! -name "$README" | sort > "$TEMP_FILE"
|
||||
|
||||
# Extract the list of .md files from README.md
|
||||
grep -o '\[.*\](.*\.md)' "$README" | sed 's/^.*(\(.*\))$/\1/' | sort > "${README}.old"
|
||||
# Function to get the title from a Markdown file
|
||||
get_title() {
|
||||
local file="$1"
|
||||
grep -m 1 '^# ' "$file" | sed 's/^# //'
|
||||
}
|
||||
|
||||
# Compare and update README.md
|
||||
comm -23 "${README}.old" "$TEMP_FILE" | while read -r file; do
|
||||
echo "Removing $file from $README"
|
||||
sed -i "\|$file|d" "$README"
|
||||
# Start with a clean README.md
|
||||
echo "# Liste des fichiers Markdown" > "$README"
|
||||
|
||||
# Initialize variable to track the last directory
|
||||
last_directory=""
|
||||
|
||||
# Read the list of files and append to README.md
|
||||
while read -r file; do
|
||||
title=$(get_title "$file")
|
||||
# Convert file path to hierarchical levels
|
||||
IFS='/' read -r -a path_parts <<< "$file"
|
||||
indent=""
|
||||
for ((i=1; i<${#path_parts[@]}-1; i++)); do
|
||||
indent="$indent "
|
||||
done
|
||||
# Determine the current directory name
|
||||
if [ ${#path_parts[@]} -gt 2 ]; then
|
||||
level="${path_parts[-2]}"
|
||||
capitalized_level=$(echo "$level" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}')
|
||||
|
||||
comm -13 "${README}.old" "$TEMP_FILE" | while read -r file; do
|
||||
echo "Adding $file to $README"
|
||||
echo "- [$file]($file)" >> "$README"
|
||||
done
|
||||
# Only add the directory name if it's different from the last one
|
||||
if [ "$last_directory" != "$capitalized_level" ]; then
|
||||
echo "$indent- **${capitalized_level}**" >> "$README"
|
||||
last_directory="$capitalized_level"
|
||||
fi
|
||||
echo "$indent - [$title]($file)" >> "$README"
|
||||
else
|
||||
echo "- [$title]($file)" >> "$README"
|
||||
fi
|
||||
done < "$TEMP_FILE"
|
||||
|
||||
# Clean up
|
||||
rm "$TEMP_FILE" "${README}.old"
|
||||
rm "$TEMP_FILE"
|
||||
|
||||
echo "$README has been updated."
|
||||
|
|
Loading…
Reference in New Issue