Linux backup
LINUX MYSQL DATABASE BACKUP USING AUTOMATIC SCHEDULED JOBS
# Set the database credentials DB_USER="openmrs" DB_PASS="openmrs" DB_NAME="openmrs" # Set the backup filename and location BACKUP_DIR="/var/backups/mysql" BACKUP_FILE="$BACKUP_DIR/openmrs-backup-$(date +%Y%m%d-%H%M%S).sql" COMPRESSED_FILE="$BACKUP_DIR/openmrs-backup-$(date +%Y%m%d-%H%M%S).zip" # Create the backup file ensure to change your mysql.sock if it is different from the default one mysqldump -u "$DB_USER" -p"$DB_PASS" -d "$DB_NAME" > "$BACKUP_FILE" # Compress the backup file zip -r "$COMPRESSED_FILE" "$BACKUP_FILE" chmod 666 $COMPRESSED_FILE # Remove the original backup file rm "$BACKUP_FILE"
SENDING BACKUPS TO REMOTE SERVER
Last updated