Sauvegarde exemple:
FULL:
SAV_USER.sh #!/bin/sh # # cp based backup script. # dat=$(date +%Y%m%d) cd "/media/VOTRE_USER/DOSSIER_RECPTION/" 2>/dev/null RetourCode=${?} if [[ $RetourCode == 1 ]] then echo "Branche le lecteur" exit 1 fi echo -n "Voulez-SAUVEGARDER Y/N : " read ouinon if [ "$ouinon" = "y" ] || [ "$ouinon" = "Y" ] then chemin_sav="/media/VOTRE_USER/DOSSIER_RECPTION/VOTRE_USER_"$dat echo $chemin_sav mkdir $chemin_sav 2>/dev/null RetourCode=${?} if [[ $RetourCode == 1 ]] then echo "Dossier de sauvegarde déjà existant" exit 1 fi cd $chemin_sav export PATH=$PATH:/opt/PostgreSQL/bin echo "sauvegarde PostgreSQL CGIFCH" CGIFCH_DATA="CGIFCH_DATA_"$dat".backup" CGIFCH_SCHEMA="CGIFCH_SCHEMA_"$dat".backup" echo -n "File PostgreSQL --- A Sauvegarder :" echo "$CGIFCH_DATA" echo -n "File PostgreSQL --- A Sauvegarder :" echo "$CGIFCH_SCHEMA" # DATA pg_dump --format custom -a --encoding utf8 --host 127.1.1 --port 5432 --username postgres CGIFCH > $CGIFCH_DATA # SCHEMA pg_dump --format custom --section pre-data --section post-data --encoding utf8 --host 127.1.1 --port 5432 --username postgres CGIFCH > $CGIFCH_SCHEMA cp -r -u -x -v /home/VOTRE_USER $chemin_sav echo "sauvegarde Repertoire FULL Terminer" elif [ "$ouinon" = "n" ] || [ "$ouinon"= "N" ] then echo "Ok, bye!" exit 0 else echo "Il faut taper Y ou N!! Pas $ouinon" exit 0 fi exit 0 exit 0
Return