16 lines
334 B
Bash
Executable File
16 lines
334 B
Bash
Executable File
#!/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"
|