#!/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"