Articles Comments

{ Berbagi, Menulis, Dan Mengajar } Ilmu… » 7. Operating System » Script Backup Milik Arif PTPN-XI … backup

Script Backup Milik Arif PTPN-XI … backup

#! /bin/bash

TIMESTAMP=$(date +”%F”)
BACKUP_DIR=”/home/laily/backup/$TIMESTAMP”
MYSQL_USER=”backup”
MYSQL=/usr/bin/mysql
MYSQL_PASSWORD=”backupproaksi”
MYSQLDUMP=/usr/bin/mysqldump

mkdir -p “$BACKUP_DIR”

databases=`$MYSQL –user=$MYSQL_USER -p$MYSQL_PASSWORD -e “SHOW DATABASES;” | grep -Ev “(Database|information_schema|performance_schema)”`

for db in $databases; do
$MYSQLDUMP –force –opt –single-transaction –user=$MYSQL_USER -p$MYSQL_PASSWORD –databases $db | gzip > “$BACKUP_DIR/$db.gz”
done

Filed under: 7. Operating System

Leave a Reply

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>