Compare commits
2 Commits
b8711daa5d
...
9d8748f150
Author | SHA1 | Date | |
---|---|---|---|
|
9d8748f150 | ||
|
9228d915fb |
1
sauvBDD/AP23bis
Submodule
1
sauvBDD/AP23bis
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit b8711daa5dd4326e2beafedae35174f1ccbad693
|
253
sauvBDD/backup.sql
Executable file
253
sauvBDD/backup.sql
Executable file
File diff suppressed because one or more lines are too long
24
sauvBDD/restauredb
Executable file
24
sauvBDD/restauredb
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
save () {
|
||||||
|
echo "Restauration de la base de données en cours ..."
|
||||||
|
zcat "${BACKUP_DIR}/catalogue_latest.sql.gz" | ssh root@ap23 "mysql -u admin -padmin ${DB_NAME}"
|
||||||
|
}
|
||||||
|
|
||||||
|
DATE=$(date "+%u")
|
||||||
|
DB_USER="usersave"
|
||||||
|
DB_PASS="saveuser"
|
||||||
|
DB_NAME="catalogue"
|
||||||
|
BACKUP_DIR="/root/bu"
|
||||||
|
BACKUP_NAME="${BACKUP_DIR}/${DB_NAME}-${DATE}.sql.gz"
|
||||||
|
|
||||||
|
#S'assurer que lutilisateur veuille restaurer la base
|
||||||
|
read -p "êtes-vous certain de vouloir restaurer la base de données ? (y/n) " answer
|
||||||
|
if [[ $answer == "y" ]] ; then
|
||||||
|
save
|
||||||
|
else
|
||||||
|
echo "Stop"
|
||||||
|
fi
|
||||||
|
exit 0
|
15
sauvBDD/sauvedb
Executable file
15
sauvBDD/sauvedb
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Variables
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
DATE=$(date "+%u")
|
||||||
|
DB_USER="usersave"
|
||||||
|
DB_PASS="saveuser"
|
||||||
|
DB_NAME="catalogue"
|
||||||
|
BACKUP_DIR="/root/bu"
|
||||||
|
BACKUP_NAME="${BACKUP_DIR}/${DB_NAME}-${DATE}.sql.gz"
|
||||||
|
|
||||||
|
ssh root@ap23 "mysqldump -u admin -padmin ${DB_NAME}|gzip" > "${BACKUP_NAME}"
|
||||||
|
|
||||||
|
cp "${BACKUP_NAME}" "${BACKUP_DIR}/catalogue_latest.sql.gz"
|
Loading…
x
Reference in New Issue
Block a user