Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Copyright © 2022 Benoît Boudaud <https://miamondo.org/contact>
- # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
- # License as published by the Free Software Foundation, either version 3 of the License, or any later version.
- # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- # You should have received a copy of the GNU General Public License along with this program.
- # If not, see <http://www.gnu.org/licenses/>
- # Auteur : Benoît Boudaud
- # Nom du script : backup_rsync.sh
- # Fonction : Synchronisation et sauvegarde du répertoire utilisateur
- # ---- TRADUCTIONS -----------------------------------------------------------------------------------------------------
- nl_title="SYNCHRONISATIE EN BACK-UP VAN DE GEBRUIKERSMAP"
- fr_title="SYNCHRONISATION ET SAUVEGARDE DU RÉPERTOIRE UTILISATEUR"
- nl_to="Standaardbestemming: $USER@server-boudaud\n\
- Druk op de Enter toets als u hier tevreden mee bent, of voer een andere bestemming in."
- fr_to="Destination par défaut: $USER@server-boudaud\n\
- Pressez la touche Entrée si cela vous convient, ou renseignez une autre destination."
- nl_default_sync="Standaard gesynchroniseerde mappen: Documenten Afbeeldingen Muziek 'Video\'s'\n\
- Druk op de Enter toets als u hier tevreden mee bent, of Voer andere de te synchroniseren mappen in, gescheiden door een spatie."
- fr_default_sync="Répertoires synchronisés par défaut: Documents Images Musique Videos\n\
- Pressez la touche Entrée si cela vous convient, ou choisissez d'autres répertoires à synchroniser, en les séparant par un espace."
- nl_end="Gedaan. Druk op de Enter-toets."
- fr_end="Terminé. Veuillez presser la touche Entrée."
- if [[ "$LANG" == "nl_NL.UTF-8" ]]; then # Nederlands
- title=$nl_title
- to=$nl_to
- default_sync=$nl_default_sync
- default_directories=(Documenten Afbeeldingen Muziek "Video's")
- end=$nl_end
- elif [[ "$LANG" == "fr_FR.UTF-8" ]]; then # Français
- title=$fr_title
- to=$fr_to
- default_sync=$fr_default_sync
- default_directories=(Documents Images Musique Videos)
- end=$fr_end
- fi
- echo $title
- echo
- echo -e $to
- # --- CHOIX DE LA DESTINATION ------------------------------------------------------------------------------------------
- default_destination="$USER@server-boudaud"
- read destination
- destination=${destination:-${default_destination}}
- echo $destination
- echo
- # ---- CHOIX DES RÉPERTOIRES À SYNCHRONISER ----------------------------------------------------------------------------
- echo -e $default_sync
- read directories
- directories=${directories:-${default_directories[@]}}
- echo $directories
- # ---- SYNCHRONISATION ET MISE À JOUR DU SUPPORT DE SAUVEGARDE ---------------------------------------------------------
- rsync -avz --delete-after ${directories[@]} $destination:/home/$(echo $destination | cut -d '@' -f 1)
- echo
- echo $end
- read
Add Comment
Please, Sign In to add comment