MAJ script sauvegarde

This commit is contained in:
“Mehdi 2021-03-30 11:53:39 +02:00
parent ae9a7e9be9
commit 2025b1ab3c
2 changed files with 13 additions and 3 deletions

View File

@ -1,4 +1,13 @@
#!/bin/bash
DAT=$(date "+%u")
scp /root/sauvegarde/gsbvisite-$DAT.sql.gz root@ppe21:/root
bdname="bdgsb2"
ssh root@ppe21 'echo "use bdgsb2;"|mysql -u admin -padmin'
if [[ $? != 0 ]]; then
ssh root@ppe21 'echo "create database bdgsb2;"|mysql -u admin -padmin'
fi
if ! [[ -r gsbvisite-latest.sql.gz ]]; then
echo "$0 : fichier gsbvisite-latest introuvable"
exit 1
fi
zcat gsbvisite-latest.sql.gz | ssh root@ppe21 "mysql -u admin -padmin bdgsb2"
exit 0

3
svbase
View File

@ -1,4 +1,5 @@
#!/bin/bash
DAT=$(date "+%u")
ssh root@ppe21 "mysqldump -u admin -padmin bdgsb | gzip" > /root/sauvegarde/gsbvisite-$DAT.sql.gz
ssh root@ppe21 "mysqldump -u admin -padmin bdgsb | gzip" > /root/sauvegarde/gsbvisite-${DAT}.sql.gz
cp /root/sauvegarde/gsbvisite-${DAT}.sql.gz /root/sauvegarde/gsbvisite-latest.sql.gz