From 80d67a50fb0384833a96e91d757547e9d44f3df3 Mon Sep 17 00:00:00 2001 From: Corentin Date: Wed, 23 Nov 2022 14:12:59 +0100 Subject: [PATCH] ajout script --- AP31/script_restore.sh | 4 ++++ AP31/script_sauvegarde.sh | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100755 AP31/script_restore.sh create mode 100755 AP31/script_sauvegarde.sh diff --git a/AP31/script_restore.sh b/AP31/script_restore.sh new file mode 100755 index 0000000..244638d --- /dev/null +++ b/AP31/script_restore.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# transfert de la base de donnée vers le serveur distant +zcat /root/sv/dump.latest.gz|ssh debian@ap31-test "mysql -u Adminer -pAdminer SDIS30" diff --git a/AP31/script_sauvegarde.sh b/AP31/script_sauvegarde.sh new file mode 100755 index 0000000..bf9089f --- /dev/null +++ b/AP31/script_sauvegarde.sh @@ -0,0 +1,8 @@ +#!/bin/bash +DAT=$(date "+%u") + +# On compresse la base avec le filtre gzip +ssh ap31-test "mysqldump -u Adminer -pAdminer SDIS29|gzip" > /root/sv/SDIS29-dump-$DAT.sql.gz + +# Permet d'obtenir la dernière sauvegarde +cp /root/sv/SDIS29-dump-$DAT.sql.gz /root/sv/dump-latest.sql.gz